eeeeeeeeeeeeeeu
parent
a316fd1ed8
commit
4610c2908c
|
@ -11,16 +11,26 @@
|
||||||
--authenticationDatabase admin
|
--authenticationDatabase admin
|
||||||
--out {{ mongo_backup_dir }}
|
--out {{ mongo_backup_dir }}
|
||||||
with_items: "{{ db_names }}"
|
with_items: "{{ db_names }}"
|
||||||
- name: Get the current weekday
|
|
||||||
shell: date +%a
|
|
||||||
register: weekday
|
|
||||||
changed_when: false
|
|
||||||
- name: Archive each directory separately
|
- name: Archive each directory separately
|
||||||
command: >
|
command: >
|
||||||
tar -czf "{{ backup_dir }}/{{ item }}-{{ weekday.stdout }}.tar.gz" -C "{{ backup_dir }}" "{{ item }}"
|
tar -czf "{{ backup_dir }}/{{server}}-{{mongodb_container}}-{{ item }}.tar.gz" -C "{{ backup_dir }}" "{{ item }}"
|
||||||
loop: "{{ db_names }}"
|
loop: "{{ db_names }}"
|
||||||
- name: Delete backed-up directories
|
- name: Delete backed-up directories
|
||||||
file:
|
file:
|
||||||
path: "{{ backup_dir }}/{{ item }}"
|
path: "{{ backup_dir }}/{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ db_names }}"
|
loop: "{{ db_names }}"
|
||||||
|
- name: Get the current weekday
|
||||||
|
shell: date +%a
|
||||||
|
register: weekday
|
||||||
|
changed_when: false
|
||||||
|
- name: send them to s3
|
||||||
|
command: >
|
||||||
|
s3cmd put {{ backup_dir }}/{{server}}-{{mongodb_container}}-{{ item }}.tar.gz
|
||||||
|
{{ s3_folder }}/{{ weekday.stdout }}/{{ backup_dir }}/{{server}}-{{mongodb_container}}-{{ item }}.tar.gz
|
||||||
|
with_items: "{{ db_names }}"
|
||||||
|
- name: Delete backed-up files
|
||||||
|
file:
|
||||||
|
path: "{{ backup_dir }}/{{server}}-{{mongodb_container}}-{{ item }}.tar.gz"
|
||||||
|
state: absent
|
||||||
|
loop: "{{ db_names }}"
|
Loading…
Reference in New Issue