2023-08-23 20:48:34 -04:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Install Docker packages
|
|
|
|
community.general.pacman:
|
|
|
|
name:
|
|
|
|
- docker
|
|
|
|
- docker-compose
|
|
|
|
|
2023-08-27 20:33:18 -04:00
|
|
|
- name: Create docker user
|
|
|
|
user:
|
|
|
|
name: docker
|
|
|
|
group: docker
|
|
|
|
|
2023-09-02 18:20:46 -04:00
|
|
|
- name: Create Gitea user
|
|
|
|
user:
|
|
|
|
name: gitea
|
|
|
|
register: user_gitea
|
|
|
|
when: '"gitea" in groups'
|
|
|
|
|
2023-08-23 20:48:34 -04:00
|
|
|
- name: Create docker-compose directory
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ docker_compose_dir }}"
|
|
|
|
owner: "{{ admin_username }}"
|
|
|
|
group: "{{ admin_username }}"
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Generate docker-compose.yml
|
|
|
|
template:
|
2023-08-27 17:39:08 -04:00
|
|
|
src: "docker-compose.yml.j2"
|
2023-08-23 20:48:34 -04:00
|
|
|
dest: "{{ docker_compose_dir }}/docker-compose.yml"
|
2023-08-27 21:59:01 -04:00
|
|
|
register: generateComp
|
2023-08-23 20:48:34 -04:00
|
|
|
|
2023-08-27 17:39:08 -04:00
|
|
|
- name: Create systemd unit file
|
|
|
|
template:
|
|
|
|
src: "docker-compose.service.j2"
|
|
|
|
dest: "/etc/systemd/system/docker-compose.service"
|
|
|
|
|
2023-08-27 21:59:01 -04:00
|
|
|
- name: Compose up (update images if necessary)
|
2023-08-27 17:39:08 -04:00
|
|
|
systemd:
|
|
|
|
name: docker-compose
|
2023-08-27 21:59:01 -04:00
|
|
|
state: reloaded
|
2023-08-27 17:39:08 -04:00
|
|
|
enabled: true
|
2023-08-27 21:59:01 -04:00
|
|
|
register: compUp
|