1
0
Fork 0
myserver-configuration/roles/cloud/tasks/base.yml

34 lines
No EOL
805 B
YAML

---
- name: Check cloud directory exist
ansible.builtin.file:
path: cloud
state: directory
- name: Copy cloud conf
ansible.builtin.copy:
src: .
dest: cloud/
register: cloud_copy_files_results
- name: Ensure cron.sh as +x permission
ansible.builtin.file:
path: cloud/cron.sh
mode: u=rwx,g=rx,o=rx
modification_time: preserve
access_time: preserve
- name: Copy template conf
ansible.builtin.template:
src: "{{ item.src }}"
dest: "cloud/{{ item.dest }}"
loop:
- { src: 'docker-compose.yml', dest: 'docker-compose.yml' }
- name: Update and restart container
community.docker.docker_compose_v2:
project_src: cloud
state: present
pull: always
recreate: "{{ 'always' if cloud_copy_files_results.changed else 'auto' }}"
become: true