From 8cf38e95cc682de90b427df8e3f5a0b8e2021a25 Mon Sep 17 00:00:00 2001 From: Francesco Pantano Date: Thu, 30 Jul 2020 18:49:17 +0200 Subject: [PATCH] [TRAIN-ONLY] Set the right container_client when set/unset noout During FFU, when leapp execution is reached, ceph nodes should set noout, norebalance and a few other options to avoid data rebalancing during the reboot process. After the nodes have been upgraded, we should unset these options. Due to the fact these commands are run on different stages, container_cli is different and should be computed looking at the current status of the controller nodes. The purpose of this patch is to fix the container_client used to run commands against the Ceph cluster. Change-Id: Ib10b6ad50e1052fe69640b39a173e856a426d607 --- deployment/ceph-ansible/ceph-base.yaml | 40 +++++++++++++++++++------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/deployment/ceph-ansible/ceph-base.yaml b/deployment/ceph-ansible/ceph-base.yaml index d6f6cbe669..e8a1727377 100644 --- a/deployment/ceph-ansible/ceph-base.yaml +++ b/deployment/ceph-ansible/ceph-base.yaml @@ -584,25 +584,40 @@ outputs: when: - step|int == 1 - ansible_distribution_major_version == '8' - - name: Set noout flag - command: "{{ container_cli }} exec -u root ceph-mon-${HOSTNAME} ceph osd set {{ item }}" - with_items: - - noout - - norecover - - nobackfill - - norebalance - - nodeep-scrub + + - block: + - name: Check for docker cli + stat: + path: "/var/run/docker.sock" + register: check_docker_cli + check_mode: false + - name: Set noout flag + shell: "{{ container_client }} exec -u root ceph-mon-${HOSTNAME} ceph osd set {{ item }}" + become: true + with_items: + - noout + - norecover + - nobackfill + - norebalance + - nodeep-scrub + vars: + container_client: |- + {% set container_client = 'podman' %} + {% if check_docker_cli.stat.exists|bool %} + {% set container_client = 'docker' %} + {% endif %} + {{ container_client }} + delegate_to: "{{ ceph_mon_short_bootstrap_node_name }}" tags: - never - system_upgrade - system_upgrade_prepare when: - - step|int == 3 + - step|int == 1 - upgrade_leapp_enabled - delegate_to: "{{ ceph_mon_short_bootstrap_node_name }}" post_upgrade_tasks: - name: Unset noout flag - command: "{{ container_cli }} exec -u root ceph-mon-${HOSTNAME} ceph osd unset {{ item }}" + shell: "{{ container_cli }} exec -u root ceph-mon-${HOSTNAME} ceph osd unset {{ item }}" with_items: - noout - norecover @@ -612,6 +627,9 @@ outputs: when: step|int == 2 become: true delegate_to: "{{ ceph_mon_short_bootstrap_node_name }}" + tags: + - never + - system_upgrade puppet_config: config_image: '' config_volume: ''