correction syntaxe
[lhc/ansible.git] / play_move_and_restore.yml
index 2640df1..4a21cb2 100644 (file)
@@ -1,22 +1,44 @@
 ---
 # WARNING ATTENTION VERIFIER QU'IL Y A ASSEZ D'ESPACE SUR ATELIERS POUR CREER UNE ARCHIVES DES DATAS NEXTCLOUD
-# commande pour lancer le playbook: ansible-playbook play_move_and_restore.yml -e "site_domain=cyclocoop"
+# commande pour lancer le playbook: ansible-playbook play_move_and_restore.yml -u rominique
+
+- name: Play sur le controller
+  hosts: localhost
+  vars_prompt:
+
+    - name: DOMAIN
+      prompt: 'Domaine du site à migrer?(ex: heureux-cyclage)'
+      private: false
 
-# play sur le controller
-- hosts: localhost
   tasks:
-  - name: create nextcloud restore dir on controller
-    ansible.builtin.file:
-      path: "{{ nextcloud_tmp_path }}"
-      state: directory
-      mode: '777'
-
-# play sur ateliers
-- hosts: ateliers
+
+    - name: Rendre la var domain dispo pour le host ateliers
+      ansible.builtin.set_fact:
+        DOMAIN: "{{ DOMAIN }}"
+      delegate_to: "{{ item }}"
+      delegate_facts: true
+      loop:
+        - ateliers
+        - vm_debian11
+
+    - name: Create nextcloud restore dir on controller
+      ansible.builtin.file:
+        path: "{{ nextcloud_tmp_path }}"
+        state: directory
+        mode: '777'
+
+- name: Play sur ateliers
+  hosts: ateliers
   tasks:
-  - include_tasks: tasks/backup_from_ateliers.yml
 
-# play sur vm_upgrade
-- hosts: vm_debian11
+    - name: Include backup_from_ateliers
+      ansible.builtin.include_tasks: tasks/backup_from_ateliers.yml
+
+- name: Play sur vm_debian11
+  hosts: vm_debian11
   tasks:
-  - include_tasks: tasks/restore_to_vm.yml
\ No newline at end of file
+
+    - name: Include restore_to_vm.
+      ansible.builtin.include_tasks: tasks/restore_to_vm.yml
+
+# clean file on controller?