Testing backup

This commit is contained in:
les 2021-01-04 19:10:21 +01:00
parent 04bd584e84
commit 3a1cb57d4b
4 changed files with 32 additions and 4 deletions

8
backup.yml Normal file
View file

@ -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}

20
examples/README.md Normal file
View file

@ -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.

View file

@ -31,6 +31,6 @@
# TEST # TEST
- name: Test - name: Test
hosts: test hosts: test
roles: ['stable/common', 'stable/etherpad'] roles: ['stable/common', 'stable/etherpad', 'stable/nginx']
tags: test tags: test
vars_files: vars/test.yml vars_files: vars/frontend.yml

View file

@ -1,5 +1,5 @@
paddone: paddone:
hosts: 192.168.199.102 hosts: 192.168.200.12
cicles: cicles:
hosts: 192.168.199.105 hosts: 192.168.199.105
@ -19,7 +19,7 @@ all:
vars: vars:
passwordstore_path: cisti.org/ansible passwordstore_path: cisti.org/ansible
restic_default_folders: [] 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_repository_name: "{{ansible_hostname}}"
restic_ssh_private_key: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/restic/ssh_private returnall=true')}}" 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')}}" restic_ssh_hostname: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/restic/ssh_hostname')}}"