Use date variable from parent playbook.
This commit is contained in:
@@ -33,28 +33,16 @@
|
|||||||
label: "{{ item[1].name }}"
|
label: "{{ item[1].name }}"
|
||||||
|
|
||||||
- name: Compress all database backup files
|
- name: Compress all database backup files
|
||||||
shell: gzip {{ backup_location }}{{ item[0].name }}/{{ item[1].container }}-{{ ansible_date_time.iso8601_basic_short }}.sql
|
shell: gzip {{ backup_location }}{{ item[0].name }}/{{ item[1].container }}-{{ date }}.sql
|
||||||
loop: "{{ containers | subelements('database', skip_missing=True) }}"
|
loop: "{{ containers | subelements('database', skip_missing=True) }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item[1].name }}"
|
label: "{{ item[1].name }}"
|
||||||
|
|
||||||
- name: Create backup of volume and store to backup directory
|
- name: Create backup of volume and store to backup directory
|
||||||
shell: tar cfz {{ backup_location }}{{ item[0].name }}/{{ item[1] }}-volume-{{ ansible_date_time.iso8601_basic_short }}.tar.gz -C /var/lib/docker/volumes/{{ item[1] }}/ _data
|
shell: tar cfz {{ backup_location }}{{ item[0].name }}/{{ item[1] }}-volume-{{ date }}.tar.gz -C /var/lib/docker/volumes/{{ item[1] }}/ _data
|
||||||
become: yes
|
become: yes
|
||||||
become_method: sudo
|
become_method: sudo
|
||||||
become_user: root
|
become_user: root
|
||||||
loop: "{{ containers | subelements('volumes', skip_missing=True) }}"
|
loop: "{{ containers | subelements('volumes', skip_missing=True) }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item[1] }}"
|
label: "{{ item[1] }}"
|
||||||
|
|
||||||
# - name: Change ownership of volume backups
|
|
||||||
# file:
|
|
||||||
# path: "{{ backup_location }}{{ item[0].name }}/{{ item[1] }}-volume-{{ ansible_date_time.iso8601_basic_short }}.tar.gz"
|
|
||||||
# owner: chris
|
|
||||||
# group: chris
|
|
||||||
# become: yes
|
|
||||||
# become_method: sudo
|
|
||||||
# become_user: root
|
|
||||||
# loop: "{{ containers | subelements('volumes', skip_missing=True) }}"
|
|
||||||
# loop_control:
|
|
||||||
# label: "{{ item[1] }}"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user