[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
This commit is contained in:
Francesco Pantano 2020-07-30 18:49:17 +02:00 committed by Jose Luis Franco
parent c95be29ffc
commit 8cf38e95cc
1 changed files with 29 additions and 11 deletions

View File

@ -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: ''