From 3a1cb57d4bde1f61db5f971082cb86128810a5ed Mon Sep 17 00:00:00 2001 From: les Date: Mon, 4 Jan 2021 19:10:21 +0100 Subject: [PATCH] Testing backup --- backup.yml | 8 ++++++++ examples/README.md | 20 ++++++++++++++++++++ infra.yml | 4 ++-- inventory.yml | 4 ++-- 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 backup.yml create mode 100644 examples/README.md diff --git a/backup.yml b/backup.yml new file mode 100644 index 0000000..8bb7ad1 --- /dev/null +++ b/backup.yml @@ -0,0 +1,8 @@ +--- +# SETUP BACKUP TO EXISTENT VM +- name: Setup backup + hosts: paddone + roles: ['stable/restic'] + vars: + restic_databases: + - {name: 'etherpad', dump_command: sudo -Hiu postgres pg_dump -Fc etherpad} diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..383f032 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,20 @@ + +### Esempi + +##### Non ho voglia di fare un ruolo per il mio super servizio ma vorrei usare il ruolo `stable/restic` per fare il setup del backup. +È la situazione che sto documentando, la macchina contiene un etherpad di cui voglio gestire i backup. + +Creo un playbook temporaneo (backup.yml) +```yaml +--- +# SETUP BACKUP TO EXISTENT VM +- name: Setup backup + hosts: paddone + roles: ['stable/restic'] + vars: + restic_databases: + - {name: 'etherpad', dump_command: sudo -Hiu postgres pg_dump -Fc etherpad} +``` + +Lancio `ansible-playbook backup.yml` +Fine. \ No newline at end of file diff --git a/infra.yml b/infra.yml index db28e01..61600c6 100644 --- a/infra.yml +++ b/infra.yml @@ -31,6 +31,6 @@ # TEST - name: Test hosts: test - roles: ['stable/common', 'stable/etherpad'] + roles: ['stable/common', 'stable/etherpad', 'stable/nginx'] tags: test - vars_files: vars/test.yml + vars_files: vars/frontend.yml diff --git a/inventory.yml b/inventory.yml index 97e85a1..b420e18 100644 --- a/inventory.yml +++ b/inventory.yml @@ -1,5 +1,5 @@ paddone: - hosts: 192.168.199.102 + hosts: 192.168.200.12 cicles: hosts: 192.168.199.105 @@ -19,7 +19,7 @@ all: vars: passwordstore_path: cisti.org/ansible restic_default_folders: [] - restic_password: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/restic/{{{{ansible_hostname}}_pwd create=True nosymbols=true')}}" + restic_password: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/restic/{{ansible_hostname}}_pwd create=True nosymbols=true')}}" restic_repository_name: "{{ansible_hostname}}" restic_ssh_private_key: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/restic/ssh_private returnall=true')}}" restic_ssh_hostname: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/restic/ssh_hostname')}}"