demo_ansible/roles/traefik/tasks/main.yml

27 lines
972 B
YAML
Raw Permalink Normal View History

2021-04-04 16:45:11 +00:00
---
- name: Create service directory if needed
ansible.builtin.file: { path: "/opt/service/{{ docker_compose.project_name }}", state: directory, mode: '0700' }
- name: create traefik network
community.general.docker_network:
name: "traefik"
- name: Copy config file
ansible.builtin.copy: { src: "traefik.yml", dest: "{{ docker_compose.path }}/traefik.yml" }
notify: [ "Stop {{ docker_compose.project_name }}", "Start {{ docker_compose.project_name }}" ]
- name: Copy logrotate traefik config
ansible.builtin.copy: { src: "traefik", dest: "/etc/logrotate.d/" }
- name: Copy docker compose files
ansible.builtin.template:
src: "{{ docker_compose.file }}.j2"
dest: "{{ docker_compose.path }}/{{ docker_compose.file }}"
mode: "u=rw,go-rwx"
validate: docker-compose -f %s config
notify: [ "Stop {{ docker_compose.project_name }}", "Start {{ docker_compose.project_name }}" ]
- name: Flush handlers
ansible.builtin.meta: flush_handlers