From b9050d62297dcf2698c699a79c039701f7206bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Fri, 29 Sep 2017 12:05:43 +0200 Subject: [PATCH] update: fix var register MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even if the task is skipped, ansible registers the var as 'skipped' so this task the task using this variable for its next usage. Signed-off-by: Sébastien Han --- infrastructure-playbooks/rolling_update.yml | 40 +++++---------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index 0040fed55..234a3f00f 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -312,37 +312,24 @@ - ceph-defaults tasks: - - name: unset osd flags - command: ceph osd unset {{ item }} --cluster {{ cluster }} - with_items: - - noout - - noscrub - - nodeep-scrub - delegate_to: "{{ groups[mon_group_name][0] }}" - when: not containerized_deployment + - name: set_fact docker_exec_cmd_osd + set_fact: + docker_exec_cmd_update_osd: "docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}" + when: + - containerized_deployment - - name: unset containerized osd flags - command: | - docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph osd unset {{ item }} --cluster {{ cluster }} + - name: unset osd flags + command: "{{ docker_exec_cmd_update_osd|default('') }} ceph osd unset {{ item }} --cluster {{ cluster }}" with_items: - noout - noscrub - nodeep-scrub delegate_to: "{{ groups[mon_group_name][0] }}" - when: containerized_deployment - name: get osd versions - command: ceph --cluster {{ cluster }} versions + command: "{{ docker_exec_cmd_update_osd|default('') }} ceph --cluster {{ cluster }} versions" register: ceph_versions delegate_to: "{{ groups[mon_group_name][0] }}" - when: not containerized_deployment - - - name: containers - get osd versions - command: | - docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} versions - register: ceph_versions - delegate_to: "{{ groups[mon_group_name][0] }}" - when: containerized_deployment - name: set_fact ceph_versions_osd set_fact: @@ -352,21 +339,12 @@ # length == 1 means there is a single osds versions entry # thus all the osds are running the same version - name: complete osds upgrade - command: ceph --cluster {{ cluster }} osd require-osd-release luminous + command: "{{ docker_exec_cmd_update_osd|default('') }} ceph --cluster {{ cluster }} osd require-osd-release luminous" delegate_to: "{{ groups[mon_group_name][0] }}" when: - - not containerized_deployment - (ceph_versions.stdout|from_json).osd | length == 1 - ceph_versions_osd | string | search("ceph version 12") - - name: containers - complete osds upgrade - command: | - docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }} ceph --cluster {{ cluster }} osd require-osd-release luminous - delegate_to: "{{ groups[mon_group_name][0] }}" - when: - - containerized_deployment - - (ceph_versions.stdout|from_json).osd | length == 1 - - ceph_versions_osd | string | search("ceph version 12") - name: upgrade ceph mdss cluster