Browse Source

Testing backup

les 3 years ago
parent
commit
3a1cb57d4b
4 changed files with 32 additions and 4 deletions
  1. 8 0
      backup.yml
  2. 20 0
      examples/README.md
  3. 2 2
      infra.yml
  4. 2 2
      inventory.yml

+ 8 - 0
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}

+ 20 - 0
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.

+ 2 - 2
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

+ 2 - 2
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')}}"