homeserver-iac/roles/containers/tasks/main.yml
dogeystamp 0288cea768
roles/containers: use systemd instead of docker module
arch doesn't package python-docker-compose so just docker compose up via
systemd instead of ansible
2023-08-27 17:39:08 -04:00

31 lines
673 B
YAML

---
- name: Install Docker packages
community.general.pacman:
name:
- docker
- docker-compose
- 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:
src: "docker-compose.yml.j2"
dest: "{{ docker_compose_dir }}/docker-compose.yml"
- name: Create systemd unit file
template:
src: "docker-compose.service.j2"
dest: "/etc/systemd/system/docker-compose.service"
- name: Compose up
systemd:
name: docker-compose
state: started
enabled: true