Create main.ansible.yaml

This commit is contained in:
Expand-sys 2024-06-05 21:29:08 +10:00 committed by GitHub
commit 542fcb2705
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

18
main.ansible.yaml Normal file
View file

@ -0,0 +1,18 @@
---
- name: dump databases
hosts: all
vars:
become: true
tasks:
- name: Backup mysql databases
mysql_db:
state: dump
name: all
target: "{{ Backup_path }}/mysql-{{ db_name }}.sql"
- name: Postgres
shell:
cmd: pg_dumpall > {{ Backup_path }}/postgres-{{ db_name }}.dump.gz
creates: "{{ Backup_path }}/postgres-{{ db_name }}.dump.gz"
become: yes
become_user: postgres