]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
update: support --limit on monitor nodes
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 28 Oct 2021 14:17:24 +0000 (16:17 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Wed, 3 Nov 2021 07:48:51 +0000 (08:48 +0100)
Change needed in order to support --limit on mon nodes.
Otherwise, a call to `hostvars[groups[mon_group_name][0]]['_current_monitor_address']`
throws an error:

```
"The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute '_current_monitor_address'"
```

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2014304#c28
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 82eee4303bce3e41b5043bcb03fa3143dcdfd30d)

infrastructure-playbooks/rolling_update.yml
roles/ceph-facts/tasks/set_monitor_address.yml
tox-subset_update.ini

index 2c3ac9b37fc44acf2f41270b4318588d9d9bb090..ae264d438b100b136553493268f56b3ac4cb24e0 100644 (file)
           when: inventory_hostname in groups[mgr_group_name] | default([])
                 or groups[mgr_group_name] | default([]) | length == 0
 
+        - name: import_role ceph-facts
+          import_role:
+            name: ceph-facts
+            tasks_from: set_monitor_address.yml
+          delegate_to: "{{ groups[mon_group_name][0] }}"
+          delegate_facts: true
+
         - name: non container | waiting for the monitor to join the quorum...
           command: ceph --cluster "{{ cluster }}" -m "{{ hostvars[groups[mon_group_name][0]]['_current_monitor_address'] }}" quorum_status --format json
           register: ceph_health_raw
index b62c1c6811d833c4b823058c81362de725d83513..6f512a85d04c9ae0c426bc01cb1fc0e26d3a47c3 100644 (file)
@@ -54,4 +54,6 @@
   set_fact:
     _current_monitor_address: "{{ item.addr }}"
   with_items: "{{ _monitor_addresses }}"
-  when: inventory_hostname == item.name
+  when:
+    - (inventory_hostname == item.name and not rolling_update | default(False) | bool)
+      or (rolling_update | default(False) | bool and item.name == groups.get(mon_group_name, [])[0])
\ No newline at end of file
index 99b5470e4e4fcb24a03b3c1b8211adb466083228..679de67ca2ea90e4f3e7508c09827d23e1e1b84e 100644 (file)
@@ -58,7 +58,17 @@ commands=
   "'
 
 # upgrade mons
-  ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/rolling_update.yml --tags=mons --extra-vars "\
+# mon1
+  ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/rolling_update.yml --limit mon1 --tags=mons --extra-vars "\
+      ireallymeanit=yes \
+      ceph_dev_branch={env:UPDATE_CEPH_DEV_BRANCH:master} \
+      ceph_dev_sha1={env:UPDATE_CEPH_DEV_SHA1:latest} \
+      ceph_docker_registry_auth=True \
+      ceph_docker_registry_username={env:DOCKER_HUB_USERNAME} \
+      ceph_docker_registry_password={env:DOCKER_HUB_PASSWORD} \
+  "
+# mon0 and mon2
+  ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/rolling_update.yml --limit 'mons:!mon1' --tags=mons --extra-vars "\
       ireallymeanit=yes \
       ceph_docker_registry_auth=True \
       ceph_docker_registry_username={env:DOCKER_HUB_USERNAME} \