]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
shrink: don't use localhost node
authorDimitri Savineau <dsavinea@redhat.com>
Wed, 26 Feb 2020 15:20:05 +0000 (10:20 -0500)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 3 Mar 2020 09:32:15 +0000 (10:32 +0100)
The ceph-facts are running on localhost so if this node is using a
different OS/release that the ceph node we can have a mismatch between
docker/podman container binary.
This commit also reduces the scope of the ceph-facts role because we only
need the container_binary tasks.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
infrastructure-playbooks/shrink-mds.yml
infrastructure-playbooks/shrink-mgr.yml
infrastructure-playbooks/shrink-mon.yml
infrastructure-playbooks/shrink-osd.yml
infrastructure-playbooks/shrink-rbdmirror.yml

index 282aeb5e4ae6c4b02ece3e82044a3e9613faed29..cc508293c8c3778160569becb5140effe1e19724 100644 (file)
@@ -24,7 +24,7 @@
         tasks_from: container_binary
 
 - name: perform checks, remove mds and print cluster health
-  hosts: localhost
+  hosts: "{{ groups[mon_group_name][0] }}"
   become: true
   vars_prompt:
     - name: ireallymeanit
 
     - name: set_fact container_exec_cmd for mon0
       set_fact:
-        container_exec_cmd: "{{ hostvars[groups[mon_group_name][0]]['container_binary'] }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
+        container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ ansible_hostname }}"
       when: containerized_deployment | bool
 
     - name: exit playbook, if can not connect to the cluster
       command: "{{ container_exec_cmd | default('') }} timeout 5 ceph --cluster {{ cluster }} health"
       register: ceph_health
       until: ceph_health is succeeded
-      delegate_to: "{{ groups[mon_group_name][0] }}"
       retries: 5
       delay: 2
 
     - name: exit mds if it the deployment is containerized
       when: containerized_deployment | bool
       command: "{{ container_exec_cmd | default('') }} ceph tell mds.{{ mds_to_kill }} exit"
-      delegate_to: "{{ groups[mon_group_name][0] }}"
 
     - name: get ceph status
       command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json"
       register: ceph_status
-      delegate_to: "{{ groups[mon_group_name][0] }}"
 
     - name: set_fact current_max_mds
       set_fact:
         - name: get new ceph status
           command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json"
           register: ceph_status
-          delegate_to: "{{ groups[mon_group_name][0] }}"
 
         - name: get active mds nodes list
           set_fact:
         - name: get ceph fs dump status
           command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} fs dump -f json"
           register: ceph_fs_status
-          delegate_to: "{{ groups[mon_group_name][0] }}"
 
         - name: create a list of standby mdss
           set_fact:
 
     - name: delete the filesystem when killing last mds
       command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} fs rm --yes-i-really-mean-it {{ cephfs }}"
-      delegate_to: "{{ groups[mon_group_name][0] }}"
       when:
         - (ceph_status.stdout | from_json)['fsmap']['up'] | int == 0
         - (ceph_status.stdout | from_json)['fsmap']['up:standby'] | int == 0
   post_tasks:
     - name: show ceph health
       command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s"
-      delegate_to: "{{ groups[mon_group_name][0] }}"
index 4063b6fded6a8992bd63982def03ed64956b65d6..c68fd0e3924a9d30db57a57ea78e24289e861fc1 100644 (file)
@@ -21,7 +21,7 @@
         msg: gather facts on all Ceph hosts for following reference
 
 - name: confirm if user really meant to remove manager from the ceph cluster
-  hosts: localhost
+  hosts: "{{ groups[mon_group_name][0] }}"
   become: true
   vars_prompt:
     - name: ireallymeanit
 
     - import_role:
         name: ceph-facts
+        tasks_from: container_binary
 
     - name: set_fact container_exec_cmd
       when: containerized_deployment | bool
       set_fact:
-        container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
+        container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ ansible_hostname }}"
 
     - name: exit playbook, if can not connect to the cluster
       command: "{{ container_exec_cmd | default('') }} timeout 5 ceph --cluster {{ cluster }} health"
       register: ceph_health
       until: ceph_health is succeeded
-      delegate_to: "{{ groups[mon_group_name][0] }}"
       retries: 5
       delay: 2
 
@@ -53,7 +53,6 @@
         - name: save mgr dump output
           command: "{{ container_exec_cmd | default('') }} ceph --cluster {{cluster}} mgr dump"
           register: mgr_dump
-          delegate_to: "{{ groups[mon_group_name][0] }}"
 
         - name: get a list of names of standby mgrs
           set_fact:
       command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s -f json | grep {{ mgr_to_kill }}"
       register: mgr_in_ceph_status
       failed_when: mgr_in_ceph_status.rc == 0
-      delegate_to: "{{ groups[mon_group_name][0] }}"
       retries: 3
       delay: 5
 
   post_tasks:
     - name: show ceph health
       command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s"
-      delegate_to: "{{ groups[mon_group_name][0] }}"
index 5f012d510c20b8c632e6eed5da8f6e085f858160..54e95dcb3cef98de0f6d20f372621b9179f25939 100644 (file)
@@ -22,7 +22,7 @@
     - debug: msg="gather facts on all Ceph hosts for following reference"
 
 - name: confirm whether user really meant to remove monitor from the ceph cluster
-  hosts: localhost
+  hosts: "{{ groups[mon_group_name][0] }}"
   become: true
   vars_prompt:
     - name: ireallymeanit
@@ -65,6 +65,7 @@
 
     - import_role:
         name: ceph-facts
+        tasks_from: container_binary
 
   tasks:
     - name: pick a monitor different than the one we want to remove
index 0c564c2c385de1e50986793e4a783c7c35acb721..68aeb9a06c431abd021493be4032c0757dcc2ac4 100644 (file)
 
     - import_role:
         name: ceph-facts
-        tasks_from: container_binary.yml
+        tasks_from: container_binary
 
   post_tasks:
     - name: set_fact container_exec_cmd build docker exec command (containerized)
       set_fact:
-        container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
+        container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ ansible_hostname }}"
       when: containerized_deployment | bool
 
     - name: set_fact container_run_cmd
index ba0a18be2c01d03e974ee7180d091e08fead6ab9..15e488886c00d476632ad52ff4762571596a0fe6 100644 (file)
@@ -22,7 +22,7 @@
 
 - name: confirm whether user really meant to remove rbd mirror from the ceph
         cluster
-  hosts: localhost
+  hosts: "{{ groups[mon_group_name][0] }}"
   become: true
   vars_prompt:
     - name: ireallymeanit
@@ -35,6 +35,7 @@
 
     - import_role:
         name: ceph-facts
+        tasks_from: container_binary
 
     - name: exit playbook, if no rbdmirror was given
       fail:
     - name: set_fact container_exec_cmd for mon0
       when: containerized_deployment | bool
       set_fact:
-        container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
+        container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ ansible_hostname }}"
 
     - name: exit playbook, if can not connect to the cluster
       command: "{{ container_exec_cmd | default('') }} timeout 5 ceph --cluster {{ cluster }} -s -f json"
       register: ceph_health
       until: ceph_health is succeeded
-      delegate_to: "{{ groups[mon_group_name][0] }}"
       retries: 5
       delay: 2
 
     - name: get servicemap details
       command: "{{ container_exec_cmd | default('') }} timeout 5 ceph --cluster {{ cluster }} -s -f json"
       register: ceph_health
-      delegate_to: "{{ groups[mon_group_name][0] }}"
 
     - name: set_fact rbdmirror_gids
       set_fact:
 
     - name: show ceph health
       command: "{{ container_exec_cmd | default('') }} ceph --cluster {{ cluster }} -s"
-      delegate_to: "{{ groups[mon_group_name][0] }}"
 
     - name: check presence of "{{ rbdmirror_to_kill_hostname }}"
       fail: