ansible-role-docker_wordpress/tasks/backup.yml

23 lines
584 B
YAML

- name: docker directory
file:
path: "{{ docker_wordpress_backup_dir }}"
state: directory
- name: stop before backup
shell: |
docker-compose down
args:
chdir: /opt/{{ docker_wordpress_service_id }}/
- name: backup
shell: |
rsync -a --delete "{{ docker_wordpress_data_dir }}/{{ docker_wordpress_service_id }}/{{ item }}" "{{ docker_wordpress_backup_dir }}/{{ docker_wordpress_service_id }}/"
with_items:
- mysql
- wp_html
- name: start after backup
shell: |
docker-compose up -d
args:
chdir: /opt/{{ docker_wordpress_service_id }}/