From 50104650e7956b228c5bfd1f0e146bebdb739fe2 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Fri, 25 Sep 2020 12:15:02 -0400 Subject: [PATCH] add missing boolean filter Otherwise this will generate an ansible warning about the missing filter. [DEPRECATION WARNING]: evaluating xxx as a bare variable, this behaviour will go away and you might need to add |bool to the expression in the future. Also see CONDITIONAL_BARE_VARS configuration toggle.. This feature will be removed in version 2.12. Signed-off-by: Dimitri Savineau --- .../filestore-to-bluestore.yml | 6 ++-- infrastructure-playbooks/rolling_update.yml | 6 ++-- infrastructure-playbooks/shrink-osd.yml | 4 +-- .../storage-inventory.yml | 2 +- roles/ceph-client/tasks/create_users_keys.yml | 8 +++--- roles/ceph-client/tasks/pre_requisite.yml | 4 +-- .../installs/install_debian_packages.yml | 2 +- .../prerequisite_rhcs_iso_install.yml | 2 +- roles/ceph-common/vars/main.yml | 6 ++-- roles/ceph-config/tasks/main.yml | 6 ++-- .../tasks/rgw_systemd_environment_file.yml | 4 +-- roles/ceph-config/templates/ceph.conf.j2 | 6 ++-- roles/ceph-crash/tasks/main.yml | 10 +++---- roles/ceph-facts/tasks/facts.yml | 6 ++-- .../templates/restart_mds_daemon.sh.j2 | 2 +- .../templates/restart_mgr_daemon.sh.j2 | 2 +- .../templates/restart_mon_daemon.sh.j2 | 2 +- .../templates/restart_nfs_daemon.sh.j2 | 4 +-- .../templates/restart_osd_daemon.sh.j2 | 2 +- .../templates/restart_rbd_mirror_daemon.sh.j2 | 2 +- roles/ceph-iscsi-gw/tasks/common.yml | 6 ++-- roles/ceph-mds/tasks/common.yml | 8 +++--- .../ceph-mds/tasks/create_mds_filesystems.yml | 4 +-- roles/ceph-mds/tasks/non_containerized.yml | 6 ++-- roles/ceph-mgr/tasks/common.yml | 24 ++++++++-------- roles/ceph-mgr/tasks/main.yml | 2 +- roles/ceph-mgr/tasks/pre_requisite.yml | 2 +- roles/ceph-mon/tasks/ceph_keys.yml | 6 ++-- roles/ceph-mon/tasks/deploy_monitors.yml | 28 +++++++++---------- roles/ceph-mon/tasks/start_monitor.yml | 2 +- roles/ceph-mon/templates/ceph-mon.service.j2 | 4 +-- roles/ceph-nfs/tasks/main.yml | 8 +++--- .../tasks/pre_requisite_container.yml | 4 +-- .../tasks/pre_requisite_non_container.yml | 4 +-- .../pre_requisite_non_container_red_hat.yml | 2 +- roles/ceph-nfs/templates/ceph-nfs.service.j2 | 2 +- roles/ceph-nfs/templates/ganesha.conf.j2 | 10 +++---- roles/ceph-osd/tasks/common.yml | 8 +++--- roles/ceph-osd/tasks/openstack_config.yml | 8 +++--- roles/ceph-osd/tasks/scenarios/lvm-batch.yml | 2 +- roles/ceph-osd/tasks/scenarios/lvm.yml | 4 +-- roles/ceph-osd/tasks/start_osds.yml | 2 +- roles/ceph-rbd-mirror/tasks/common.yml | 4 +-- roles/ceph-rgw/tasks/common.yml | 12 ++++---- roles/ceph-rgw/tasks/rgw_create_pools.yml | 4 +-- roles/ceph-validate/tasks/check_nfs.yml | 2 +- 46 files changed, 127 insertions(+), 127 deletions(-) diff --git a/infrastructure-playbooks/filestore-to-bluestore.yml b/infrastructure-playbooks/filestore-to-bluestore.yml index 1ed6208df..fd9a870e1 100644 --- a/infrastructure-playbooks/filestore-to-bluestore.yml +++ b/infrastructure-playbooks/filestore-to-bluestore.yml @@ -48,7 +48,7 @@ - name: set_fact container_run_cmd set_fact: - container_run_cmd: "{{ container_binary + ' run --rm --privileged=true --net=host --pid=host --ipc=host -v /dev:/dev -v /etc/ceph:/etc/ceph -v /var/lib/ceph:/var/lib/ceph -v /var/run:/var/run --entrypoint=' if containerized_deployment else '' }}ceph-volume {{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else '' }}" + container_run_cmd: "{{ container_binary + ' run --rm --privileged=true --net=host --pid=host --ipc=host -v /dev:/dev -v /etc/ceph:/etc/ceph -v /var/lib/ceph:/var/lib/ceph -v /var/run:/var/run --entrypoint=' if containerized_deployment | bool else '' }}ceph-volume {{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else '' }}" - name: get ceph-volume lvm inventory data command: "{{ container_run_cmd }} --cluster {{ cluster }} inventory --format json" @@ -218,7 +218,7 @@ destroy: false environment: CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}" - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" loop: "{{ osd_fsid_list }}" when: osd_fsid_list is defined @@ -230,7 +230,7 @@ destroy: true environment: CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}" - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" loop: "{{ osd_fsid_list }}" when: diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index 9973268ec..dc7065925 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -154,8 +154,8 @@ - name: ensure /var/lib/ceph/bootstrap-rbd-mirror is present file: path: /var/lib/ceph/bootstrap-rbd-mirror - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: '755' state: directory delegate_to: "{{ item }}" @@ -176,7 +176,7 @@ - ['bootstrap-rbd', 'bootstrap-rbd-mirror'] - "{{ groups[mon_group_name] }}" # so the key goes on all the nodes environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" when: - cephx | bool diff --git a/infrastructure-playbooks/shrink-osd.yml b/infrastructure-playbooks/shrink-osd.yml index b4bb69af1..1c245165d 100644 --- a/infrastructure-playbooks/shrink-osd.yml +++ b/infrastructure-playbooks/shrink-osd.yml @@ -70,7 +70,7 @@ - name: set_fact container_run_cmd set_fact: - container_run_cmd: "{{ container_binary + ' run --rm --privileged=true --net=host --pid=host --ipc=host -v /dev:/dev -v /etc/ceph:/etc/ceph -v /var/lib/ceph:/var/lib/ceph -v /var/run:/var/run --entrypoint=' if containerized_deployment else '' }}ceph-volume {{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else '' }}" + container_run_cmd: "{{ container_binary + ' run --rm --privileged=true --net=host --pid=host --ipc=host -v /dev:/dev -v /etc/ceph:/etc/ceph -v /var/lib/ceph:/var/lib/ceph -v /var/run:/var/run --entrypoint=' if containerized_deployment | bool else '' }}ceph-volume {{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else '' }}" - name: exit playbook, if can not connect to the cluster command: "{{ container_exec_cmd }} timeout 5 ceph --cluster {{ cluster }} health" @@ -212,7 +212,7 @@ osd_fsid: "{{ item.1 }}" environment: CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}" - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" delegate_to: "{{ item.0 }}" loop: "{{ _osd_hosts }}" diff --git a/infrastructure-playbooks/storage-inventory.yml b/infrastructure-playbooks/storage-inventory.yml index 708262ec6..00eb3f29b 100644 --- a/infrastructure-playbooks/storage-inventory.yml +++ b/infrastructure-playbooks/storage-inventory.yml @@ -29,5 +29,5 @@ action: "inventory" environment: CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}" - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" diff --git a/roles/ceph-client/tasks/create_users_keys.yml b/roles/ceph-client/tasks/create_users_keys.yml index e65341339..47cc60bb2 100644 --- a/roles/ceph-client/tasks/create_users_keys.yml +++ b/roles/ceph-client/tasks/create_users_keys.yml @@ -39,10 +39,10 @@ dest: "{{ ceph_conf_key_directory }}" import_key: "{{ admin_key_presence }}" mode: "{{ item.mode|default(omit) }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" with_items: - "{{ keys }}" @@ -87,7 +87,7 @@ target_size_ratio: "{{ item.target_size_ratio | default(omit) }}" application: "{{ item.application | default(omit) }}" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" with_items: "{{ pools }}" changed_when: false diff --git a/roles/ceph-client/tasks/pre_requisite.yml b/roles/ceph-client/tasks/pre_requisite.yml index 697352377..5ebf24229 100644 --- a/roles/ceph-client/tasks/pre_requisite.yml +++ b/roles/ceph-client/tasks/pre_requisite.yml @@ -16,8 +16,8 @@ copy: dest: "{{ item.item.path }}" content: "{{ item.stdout + '\n' }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_keyring_permissions }}" with_items: "{{ _client_keys.results }}" when: diff --git a/roles/ceph-common/tasks/installs/install_debian_packages.yml b/roles/ceph-common/tasks/installs/install_debian_packages.yml index 6bdc03f4a..f72ff82f8 100644 --- a/roles/ceph-common/tasks/installs/install_debian_packages.yml +++ b/roles/ceph-common/tasks/installs/install_debian_packages.yml @@ -4,6 +4,6 @@ name: "{{ debian_ceph_pkgs | unique }}" update_cache: no state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - default_release: "{{ ceph_stable_release_uca | default('') if ceph_origin == 'repository' and ceph_repository == 'uca' else '' }}{{ ansible_distribution_release ~ '-backports' if ceph_origin == 'distro' and ceph_use_distro_backports else '' }}" + default_release: "{{ ceph_stable_release_uca | default('') if ceph_origin == 'repository' and ceph_repository == 'uca' else '' }}{{ ansible_distribution_release ~ '-backports' if ceph_origin == 'distro' and ceph_use_distro_backports | bool else '' }}" register: result until: result is succeeded diff --git a/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install.yml b/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install.yml index 0b7783a4c..f0899d6ce 100644 --- a/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install.yml +++ b/roles/ceph-common/tasks/installs/prerequisite_rhcs_iso_install.yml @@ -33,7 +33,7 @@ - name: copy red hat storage iso content for redhat systems shell: cp -r {{ ceph_rhcs_mount_path }}/* {{ ceph_rhcs_repository_path }} args: - creates: "{{ ceph_rhcs_repository_path+'/README' if not rolling_update else 'dummy' }}" + creates: "{{ ceph_rhcs_repository_path+'/README' if not rolling_update | bool else 'dummy' }}" - name: unmount red hat storage iso file for redhat systems mount: diff --git a/roles/ceph-common/vars/main.yml b/roles/ceph-common/vars/main.yml index cbd5a5f52..d4aead75a 100644 --- a/roles/ceph-common/vars/main.yml +++ b/roles/ceph-common/vars/main.yml @@ -6,12 +6,12 @@ debian_ceph_pkgs: - "ceph-common" - "{{ ((ceph_repository == 'rhcs') and (mon_group_name in group_names)) | ternary('ceph-mon', 'ceph-common') }}" - "{{ ((ceph_repository == 'rhcs') and (osd_group_name in group_names)) | ternary('ceph-osd', 'ceph-common') }}" - - "{{ (ceph_test) | ternary('ceph-test', 'ceph-common') }}" + - "{{ (ceph_test | bool) | ternary('ceph-test', 'ceph-common') }}" - "{{ (rgw_group_name in group_names) | ternary('radosgw', 'ceph-common') }}" - "{{ ((ceph_repository == 'rhcs') and (client_group_name in group_names)) | ternary('ceph-fuse', 'ceph-common') }}" redhat_ceph_pkgs: - - "{{ (ceph_test) | ternary('ceph-test', 'ceph-common') }}" + - "{{ (ceph_test | bool) | ternary('ceph-test', 'ceph-common') }}" - "ceph-common" - "{{ (mon_group_name in group_names) | ternary('ceph-mon', 'ceph-common') }}" - "{{ (osd_group_name in group_names) | ternary('ceph-osd', 'ceph-common') }}" @@ -20,7 +20,7 @@ redhat_ceph_pkgs: - "{{ (rgw_group_name in group_names) | ternary('ceph-radosgw', 'ceph-common') }}" suse_ceph_pkgs: - - "{{ (ceph_test) | ternary('ceph-test', 'ceph-common') }}" + - "{{ (ceph_test | bool) | ternary('ceph-test', 'ceph-common') }}" - "ceph-common" - "{{ (mon_group_name in group_names) | ternary('ceph-mon', 'ceph-common') }}" - "{{ (osd_group_name in group_names) | ternary('ceph-osd', 'ceph-common') }}" diff --git a/roles/ceph-config/tasks/main.yml b/roles/ceph-config/tasks/main.yml index 74856b51b..e56d9e09a 100644 --- a/roles/ceph-config/tasks/main.yml +++ b/roles/ceph-config/tasks/main.yml @@ -27,7 +27,7 @@ register: rejected_devices environment: CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}" - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" PYTHONIOENCODING: utf-8 @@ -54,7 +54,7 @@ register: lvm_batch_report environment: CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}" - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" PYTHONIOENCODING: utf-8 when: _devices | default([]) | length > 0 @@ -74,7 +74,7 @@ register: lvm_list environment: CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}" - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" PYTHONIOENCODING: utf-8 changed_when: false diff --git a/roles/ceph-config/tasks/rgw_systemd_environment_file.yml b/roles/ceph-config/tasks/rgw_systemd_environment_file.yml index ee310f110..54addc65b 100644 --- a/roles/ceph-config/tasks/rgw_systemd_environment_file.yml +++ b/roles/ceph-config/tasks/rgw_systemd_environment_file.yml @@ -3,8 +3,8 @@ file: path: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}.{{ item.instance_name }}" state: directory - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_directories_mode | default('0755') }}" with_items: "{{ rgw_instances }}" diff --git a/roles/ceph-config/templates/ceph.conf.j2 b/roles/ceph-config/templates/ceph.conf.j2 index 0b0588bd9..1fdb76431 100644 --- a/roles/ceph-config/templates/ceph.conf.j2 +++ b/roles/ceph-config/templates/ceph.conf.j2 @@ -2,7 +2,7 @@ # {{ ansible_managed }} [global] -{% if not cephx %} +{% if not cephx | bool %} auth cluster required = none auth service required = none auth client required = none @@ -82,7 +82,7 @@ filestore xattr use omap = true {% if osd_objectstore == 'bluestore' %} {% set _num_osds = num_osds | default(0) | int %} [osd] -{% if is_hci and _num_osds > 0 %} +{% if is_hci | bool and _num_osds > 0 %} {# hci_safety_factor is the safety factor for HCI deployments #} {% if ansible_memtotal_mb * 1048576 * hci_safety_factor / _num_osds > osd_memory_target %} {% set _osd_memory_target = (ansible_memtotal_mb * 1048576 * hci_safety_factor / _num_osds) | int %} @@ -130,7 +130,7 @@ rgw_zone = {{ instance['rgw_zone'] }} {% if inventory_hostname in groups.get(nfs_group_name, []) and inventory_hostname not in groups.get(rgw_group_name, []) %} {% for host in groups[nfs_group_name] %} {% set _rgw_hostname = hostvars[host]['rgw_hostname'] | default(hostvars[host]['ansible_hostname']) %} -{% if nfs_obj_gw %} +{% if nfs_obj_gw | bool %} [client.rgw.{{ _rgw_hostname }}] host = {{ _rgw_hostname }} keyring = /var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ _rgw_hostname }}/keyring diff --git a/roles/ceph-crash/tasks/main.yml b/roles/ceph-crash/tasks/main.yml index e27bc7965..0457302d5 100644 --- a/roles/ceph-crash/tasks/main.yml +++ b/roles/ceph-crash/tasks/main.yml @@ -10,10 +10,10 @@ dest: "{{ ceph_conf_key_directory }}" import_key: True mode: "{{ ceph_keyring_permissions }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" delegate_to: "{{ groups.get(mon_group_name, [])[0] }}" run_once: True @@ -40,8 +40,8 @@ copy: dest: "{{ ceph_conf_key_directory }}/{{ cluster }}.client.crash.keyring" content: "{{ _crash_keys.stdout + '\n' }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_keyring_permissions }}" with_items: "{{ list_target_node }}" delegate_to: "{{ item }}" diff --git a/roles/ceph-facts/tasks/facts.yml b/roles/ceph-facts/tasks/facts.yml index 654a59dcf..a2c59847d 100644 --- a/roles/ceph-facts/tasks/facts.yml +++ b/roles/ceph-facts/tasks/facts.yml @@ -38,7 +38,7 @@ block: - name: set_fact container_exec_cmd set_fact: - container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] if not rolling_update else hostvars[mon_host | default(groups[mon_group_name][0])]['ansible_hostname'] }}" + container_exec_cmd: "{{ container_binary }} exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] if not rolling_update | bool else hostvars[mon_host | default(groups[mon_group_name][0])]['ansible_hostname'] }}" when: - containerized_deployment | bool @@ -121,7 +121,7 @@ set_fact: current_fsid: rc: 1 - when: rolling_update or groups.get(mon_group_name, []) | length == 0 + when: rolling_update | bool or groups.get(mon_group_name, []) | length == 0 - name: create a local fetch directory if it does not exist file: @@ -346,7 +346,7 @@ - name: set_fact ceph_run_cmd set_fact: - ceph_run_cmd: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph/:/var/lib/ceph/:z -v /var/log/ceph/:/var/log/ceph/:z --entrypoint=ceph ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else 'ceph' }}" + ceph_run_cmd: "{{ container_binary + ' run --rm --net=host -v /etc/ceph:/etc/ceph:z -v /var/lib/ceph/:/var/lib/ceph/:z -v /var/log/ceph/:/var/log/ceph/:z --entrypoint=ceph ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'ceph' }}" delegate_to: "{{ item }}" delegate_facts: True run_once: True diff --git a/roles/ceph-handler/templates/restart_mds_daemon.sh.j2 b/roles/ceph-handler/templates/restart_mds_daemon.sh.j2 index 66038a443..8a36032aa 100644 --- a/roles/ceph-handler/templates/restart_mds_daemon.sh.j2 +++ b/roles/ceph-handler/templates/restart_mds_daemon.sh.j2 @@ -3,7 +3,7 @@ RETRIES="{{ handler_health_mds_check_retries }}" DELAY="{{ handler_health_mds_check_delay }}" MDS_NAME="{{ ansible_hostname }}" -{% if containerized_deployment %} +{% if containerized_deployment | bool %} DOCKER_EXEC="{{ container_binary }} exec ceph-mds-{{ ansible_hostname }}" {% endif %} diff --git a/roles/ceph-handler/templates/restart_mgr_daemon.sh.j2 b/roles/ceph-handler/templates/restart_mgr_daemon.sh.j2 index c9f355400..d5a715689 100644 --- a/roles/ceph-handler/templates/restart_mgr_daemon.sh.j2 +++ b/roles/ceph-handler/templates/restart_mgr_daemon.sh.j2 @@ -3,7 +3,7 @@ RETRIES="{{ handler_health_mgr_check_retries }}" DELAY="{{ handler_health_mgr_check_delay }}" MGR_NAME="{{ ansible_hostname }}" -{% if containerized_deployment %} +{% if containerized_deployment | bool %} DOCKER_EXEC="{{ container_binary }} exec ceph-mgr-{{ ansible_hostname }}" {% endif %} diff --git a/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 b/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 index e8344cbef..6d5ee611e 100644 --- a/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 +++ b/roles/ceph-handler/templates/restart_mon_daemon.sh.j2 @@ -3,7 +3,7 @@ RETRIES="{{ handler_health_mon_check_retries }}" DELAY="{{ handler_health_mon_check_delay }}" MONITOR_NAME="{{ monitor_name }}" -{% if containerized_deployment %} +{% if containerized_deployment | bool %} DOCKER_EXEC="{{ container_binary }} exec ceph-mon-{{ ansible_hostname }}" {% endif %} diff --git a/roles/ceph-handler/templates/restart_nfs_daemon.sh.j2 b/roles/ceph-handler/templates/restart_nfs_daemon.sh.j2 index 0fab87cc0..c76432a34 100644 --- a/roles/ceph-handler/templates/restart_nfs_daemon.sh.j2 +++ b/roles/ceph-handler/templates/restart_nfs_daemon.sh.j2 @@ -4,12 +4,12 @@ RETRIES="{{ handler_health_nfs_check_retries }}" DELAY="{{ handler_health_nfs_check_delay }}" NFS_NAME="ceph-nfs@{{ ceph_nfs_service_suffix | default(ansible_hostname) }}" PID=/var/run/ganesha.pid -{% if containerized_deployment %} +{% if containerized_deployment | bool %} DOCKER_EXEC="{{ container_binary }} exec ceph-nfs-{{ ceph_nfs_service_suffix | default(ansible_hostname) }}" {% endif %} # First, restart the daemon -{% if containerized_deployment -%} +{% if containerized_deployment | bool -%} systemctl restart $NFS_NAME # Wait and ensure the pid exists after restarting the daemon while [ $RETRIES -ne 0 ]; do diff --git a/roles/ceph-handler/templates/restart_osd_daemon.sh.j2 b/roles/ceph-handler/templates/restart_osd_daemon.sh.j2 index 597baaacd..51d2d10ab 100644 --- a/roles/ceph-handler/templates/restart_osd_daemon.sh.j2 +++ b/roles/ceph-handler/templates/restart_osd_daemon.sh.j2 @@ -61,7 +61,7 @@ for unit in $(systemctl list-units | grep -E "loaded * active" | grep -oE "ceph- # We need to wait because it may take some time for the socket to actually exists COUNT=10 # Wait and ensure the socket exists after restarting the daemon - {% if containerized_deployment %} + {% if containerized_deployment | bool %} osd_id=$(echo ${unit#ceph-osd@} | grep -oE '[0-9]+') container_id=$(get_container_id_from_dev_name "ceph-osd-${osd_id}") container_exec="{{ container_binary }} exec $container_id" diff --git a/roles/ceph-handler/templates/restart_rbd_mirror_daemon.sh.j2 b/roles/ceph-handler/templates/restart_rbd_mirror_daemon.sh.j2 index 5fb23454a..1bdf1d7cf 100644 --- a/roles/ceph-handler/templates/restart_rbd_mirror_daemon.sh.j2 +++ b/roles/ceph-handler/templates/restart_rbd_mirror_daemon.sh.j2 @@ -3,7 +3,7 @@ RETRIES="{{ handler_health_rbd_mirror_check_retries }}" DELAY="{{ handler_health_rbd_mirror_check_delay }}" RBD_MIRROR_NAME="{{ ansible_hostname }}" -{% if containerized_deployment %} +{% if containerized_deployment | bool %} DOCKER_EXEC="{{ container_binary }} exec ceph-rbd-mirror-{{ ansible_hostname }}" {% endif %} diff --git a/roles/ceph-iscsi-gw/tasks/common.yml b/roles/ceph-iscsi-gw/tasks/common.yml index becd37638..cd876fb60 100644 --- a/roles/ceph-iscsi-gw/tasks/common.yml +++ b/roles/ceph-iscsi-gw/tasks/common.yml @@ -14,8 +14,8 @@ copy: dest: "{{ item.item.path }}" content: "{{ item.stdout + '\n' }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_keyring_permissions }}" with_items: "{{ _iscsi_keys.results }}" when: @@ -60,5 +60,5 @@ size: "{{ iscsi_pool_size | default(osd_pool_default_size) }}" application: "rbd" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" \ No newline at end of file diff --git a/roles/ceph-mds/tasks/common.yml b/roles/ceph-mds/tasks/common.yml index 1d5364a70..0c7ad5880 100644 --- a/roles/ceph-mds/tasks/common.yml +++ b/roles/ceph-mds/tasks/common.yml @@ -3,8 +3,8 @@ file: path: "{{ item }}" state: directory - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_directories_mode }}" with_items: - /var/lib/ceph/bootstrap-mds/ @@ -26,8 +26,8 @@ copy: dest: "{{ item.item.path }}" content: "{{ item.stdout + '\n' }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_keyring_permissions }}" with_items: "{{ _mds_keys.results }}" when: diff --git a/roles/ceph-mds/tasks/create_mds_filesystems.yml b/roles/ceph-mds/tasks/create_mds_filesystems.yml index 15c201a51..93ec880d4 100644 --- a/roles/ceph-mds/tasks/create_mds_filesystems.yml +++ b/roles/ceph-mds/tasks/create_mds_filesystems.yml @@ -19,7 +19,7 @@ with_items: "{{ cephfs_pools }}" delegate_to: "{{ groups[mon_group_name][0] }}" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" - name: check and create ceph filesystem @@ -42,4 +42,4 @@ delegate_to: "{{ groups[mon_group_name][0] }}" when: - mds_max_mds > 1 - - not rolling_update + - not rolling_update | bool diff --git a/roles/ceph-mds/tasks/non_containerized.yml b/roles/ceph-mds/tasks/non_containerized.yml index a3bef65ab..fe683f412 100644 --- a/roles/ceph-mds/tasks/non_containerized.yml +++ b/roles/ceph-mds/tasks/non_containerized.yml @@ -3,7 +3,7 @@ apt: name: ceph-mds state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - default_release: "{{ ceph_stable_release_uca | default('') if ceph_origin == 'repository' and ceph_repository == 'uca' else '' }}{{ ansible_distribution_release ~ '-backports' if ceph_origin == 'distro' and ceph_use_distro_backports else '' }}" + default_release: "{{ ceph_stable_release_uca | default('') if ceph_origin == 'repository' and ceph_repository == 'uca' else '' }}{{ ansible_distribution_release ~ '-backports' if ceph_origin == 'distro' and ceph_use_distro_backports | bool else '' }}" when: - mds_group_name in group_names - ansible_os_family == 'Debian' @@ -25,7 +25,7 @@ args: creates: /var/lib/ceph/mds/{{ cluster }}-{{ ansible_hostname }}/keyring changed_when: false - when: cephx + when: cephx | bool - name: set mds key permissions file: @@ -33,7 +33,7 @@ owner: "ceph" group: "ceph" mode: "0600" - when: cephx + when: cephx | bool - name: ensure systemd service override directory exists file: diff --git a/roles/ceph-mgr/tasks/common.yml b/roles/ceph-mgr/tasks/common.yml index 8f94c8b9c..79bcd43e6 100644 --- a/roles/ceph-mgr/tasks/common.yml +++ b/roles/ceph-mgr/tasks/common.yml @@ -3,8 +3,8 @@ file: path: /var/lib/ceph/mgr/{{ cluster }}-{{ ansible_hostname }} state: directory - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_directories_mode }}" - name: fetch ceph mgr keyring @@ -16,12 +16,12 @@ mds: allow * cluster: "{{ cluster }}" secret: "{{ (mgr_secret != 'mgr_secret') | ternary(mgr_secret, omit) }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "0400" dest: "/var/lib/ceph/mgr/{{ cluster }}-{{ ansible_hostname }}/keyring" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" when: groups.get(mgr_group_name, []) | length == 0 # the key is present already since one of the mons created it in "create ceph mgr keyring(s)" @@ -37,11 +37,11 @@ mds: allow * cluster: "{{ cluster }}" secret: "{{ (mgr_secret != 'mgr_secret') | ternary(mgr_secret, omit) }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "0400" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" with_items: "{{ groups.get(mgr_group_name, []) }}" run_once: True @@ -66,8 +66,8 @@ copy: dest: "{{ item.item.path }}" content: "{{ item.stdout + '\n' }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_keyring_permissions }}" with_items: "{{ _mgr_keys.results }}" when: @@ -77,7 +77,7 @@ - name: set mgr key permissions file: path: /var/lib/ceph/mgr/{{ cluster }}-{{ ansible_hostname }}/keyring - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_keyring_permissions }}" when: cephx | bool diff --git a/roles/ceph-mgr/tasks/main.yml b/roles/ceph-mgr/tasks/main.yml index d5cf2ef1e..649e34675 100644 --- a/roles/ceph-mgr/tasks/main.yml +++ b/roles/ceph-mgr/tasks/main.yml @@ -21,6 +21,6 @@ - name: include mgr_modules.yml include_tasks: mgr_modules.yml when: - - ceph_mgr_modules | length > 0 or dashboard_enabled + - ceph_mgr_modules | length > 0 or dashboard_enabled | bool - ((groups[mgr_group_name] | default([]) | length == 0 and inventory_hostname == groups[mon_group_name] | last) or (groups[mgr_group_name] | default([]) | length > 0 and inventory_hostname == groups[mgr_group_name] | last)) diff --git a/roles/ceph-mgr/tasks/pre_requisite.yml b/roles/ceph-mgr/tasks/pre_requisite.yml index 76102e22f..cd4740ae1 100644 --- a/roles/ceph-mgr/tasks/pre_requisite.yml +++ b/roles/ceph-mgr/tasks/pre_requisite.yml @@ -30,7 +30,7 @@ apt: name: '{{ ceph_mgr_packages }}' state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - default_release: "{{ ceph_stable_release_uca | default('') if ceph_origin == 'repository' and ceph_repository == 'uca' else ''}}{{ ansible_distribution_release ~ '-backports' if ceph_origin == 'distro' and ceph_use_distro_backports else '' }}" + default_release: "{{ ceph_stable_release_uca | default('') if ceph_origin == 'repository' and ceph_repository == 'uca' else ''}}{{ ansible_distribution_release ~ '-backports' if ceph_origin == 'distro' and ceph_use_distro_backports | bool else '' }}" register: result until: result is succeeded when: ansible_os_family == 'Debian' diff --git a/roles/ceph-mon/tasks/ceph_keys.yml b/roles/ceph-mon/tasks/ceph_keys.yml index afcb6ecca..ee14cb3eb 100644 --- a/roles/ceph-mon/tasks/ceph_keys.yml +++ b/roles/ceph-mon/tasks/ceph_keys.yml @@ -19,11 +19,11 @@ ceph_key: state: fetch_initial_keys cluster: "{{ cluster }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "0400" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" CEPH_ROLLING_UPDATE: "{{ rolling_update }}" when: diff --git a/roles/ceph-mon/tasks/deploy_monitors.yml b/roles/ceph-mon/tasks/deploy_monitors.yml index 4f9ee58f5..42a076458 100644 --- a/roles/ceph-mon/tasks/deploy_monitors.yml +++ b/roles/ceph-mon/tasks/deploy_monitors.yml @@ -35,11 +35,11 @@ caps: mon: allow * import_key: False - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "0400" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" - name: copy the initial key in /etc/ceph (for containers) @@ -53,8 +53,8 @@ file: path: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }} state: directory - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_directories_mode }}" recurse: true @@ -65,11 +65,11 @@ caps: "{{ client_admin_ceph_authtool_cap }}" import_key: False cluster: "{{ cluster }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "0400" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" register: create_custom_admin_secret when: @@ -78,7 +78,7 @@ - name: set_fact ceph-authtool container command set_fact: - ceph_authtool_cmd: "{{ container_binary + ' run --net=host --rm -v /var/lib/ceph:/var/lib/ceph:z -v /etc/ceph/:/etc/ceph/:z --entrypoint=ceph-authtool ' + ceph_client_docker_registry + '/' + ceph_client_docker_image + ':' + ceph_client_docker_image_tag if containerized_deployment else 'ceph-authtool' }}" + ceph_authtool_cmd: "{{ container_binary + ' run --net=host --rm -v /var/lib/ceph:/var/lib/ceph:z -v /etc/ceph/:/etc/ceph/:z --entrypoint=ceph-authtool ' + ceph_client_docker_registry + '/' + ceph_client_docker_image + ':' + ceph_client_docker_image_tag if containerized_deployment | bool else 'ceph-authtool' }}" - name: import admin keyring into mon keyring command: > @@ -91,14 +91,14 @@ - name: set_fact ceph-mon container command set_fact: - ceph_mon_cmd: "{{ container_binary + ' run --rm --net=host -v /var/lib/ceph/:/var/lib/ceph:z -v /etc/ceph/:/etc/ceph/:z --entrypoint=ceph-mon ' + ceph_client_docker_registry + '/' + ceph_client_docker_image + ':' +ceph_client_docker_image_tag if containerized_deployment else 'ceph-mon' }}" + ceph_mon_cmd: "{{ container_binary + ' run --rm --net=host -v /var/lib/ceph/:/var/lib/ceph:z -v /etc/ceph/:/etc/ceph/:z --entrypoint=ceph-mon ' + ceph_client_docker_registry + '/' + ceph_client_docker_image + ':' +ceph_client_docker_image_tag if containerized_deployment | bool else 'ceph-mon' }}" - name: ceph monitor mkfs with keyring command: > {{ ceph_mon_cmd }} --cluster {{ cluster }} - --setuser "{{ ceph_uid if containerized_deployment else 'ceph' }}" - --setgroup "{{ ceph_uid if containerized_deployment else 'ceph' }}" + --setuser "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + --setgroup "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" --mkfs -i {{ monitor_name }} --fsid {{ fsid }} @@ -111,8 +111,8 @@ command: > {{ ceph_mon_cmd }} --cluster {{ cluster }} - --setuser "{{ ceph_uid if containerized_deployment else 'ceph' }}" - --setgroup "{{ ceph_uid if containerized_deployment else 'ceph' }}" + --setuser "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + --setgroup "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" --mkfs -i {{ monitor_name }} --fsid {{ fsid }} diff --git a/roles/ceph-mon/tasks/start_monitor.yml b/roles/ceph-mon/tasks/start_monitor.yml index c6a4e74ea..72fd5538f 100644 --- a/roles/ceph-mon/tasks/start_monitor.yml +++ b/roles/ceph-mon/tasks/start_monitor.yml @@ -25,7 +25,7 @@ - name: start the monitor service systemd: - name: ceph-mon@{{ monitor_name if not containerized_deployment else ansible_hostname }} + name: ceph-mon@{{ monitor_name if not containerized_deployment | bool else ansible_hostname }} state: started enabled: yes masked: no diff --git a/roles/ceph-mon/templates/ceph-mon.service.j2 b/roles/ceph-mon/templates/ceph-mon.service.j2 index 169cca71a..1f998a29b 100644 --- a/roles/ceph-mon/templates/ceph-mon.service.j2 +++ b/roles/ceph-mon/templates/ceph-mon.service.j2 @@ -28,10 +28,10 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --name ceph-mon-%i \ {% if ansible_distribution == 'RedHat' -%} -v /etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted:z \ {% endif -%} -{% if mon_docker_privileged -%} +{% if mon_docker_privileged | bool -%} --privileged \ {% endif -%} -{% if mon_docker_net_host -%} +{% if mon_docker_net_host | bool -%} --net=host \ {% endif -%} -e IP_VERSION={{ ip_version[-1:] }} \ diff --git a/roles/ceph-nfs/tasks/main.yml b/roles/ceph-nfs/tasks/main.yml index 4cd3bd3e2..8f336057e 100644 --- a/roles/ceph-nfs/tasks/main.yml +++ b/roles/ceph-nfs/tasks/main.yml @@ -35,8 +35,8 @@ file: path: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ item }}" state: directory - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "0755" with_items: - "{{ ceph_nfs_ceph_user }}" @@ -51,8 +51,8 @@ dest: "{{ item.1 }}" content: "{{ item.0.content | b64decode }}" mode: "{{ item.0.item.get('mode', '0600') }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" with_nested: - "{{ hostvars[groups['_filtered_clients'][0]]['slurp_client_keys']['results'] | default([]) }}" - ['/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ceph_nfs_ceph_user }}/keyring', '/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}/keyring'] diff --git a/roles/ceph-nfs/tasks/pre_requisite_container.yml b/roles/ceph-nfs/tasks/pre_requisite_container.yml index aaff416fc..78a9b9ed3 100644 --- a/roles/ceph-nfs/tasks/pre_requisite_container.yml +++ b/roles/ceph-nfs/tasks/pre_requisite_container.yml @@ -25,8 +25,8 @@ copy: dest: "{{ item.item.path }}" content: "{{ item.stdout + '\n' }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_keyring_permissions }}" with_items: "{{ _rgw_keys.results }}" when: diff --git a/roles/ceph-nfs/tasks/pre_requisite_non_container.yml b/roles/ceph-nfs/tasks/pre_requisite_non_container.yml index 4bb4f114c..6c7ffada7 100644 --- a/roles/ceph-nfs/tasks/pre_requisite_non_container.yml +++ b/roles/ceph-nfs/tasks/pre_requisite_non_container.yml @@ -63,8 +63,8 @@ copy: dest: "{{ item.item.path }}" content: "{{ item.stdout + '\n' }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_keyring_permissions }}" with_items: "{{ _rgw_keys.results }}" when: diff --git a/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml b/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml index 4ebf360ee..341f3961f 100644 --- a/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml +++ b/roles/ceph-nfs/tasks/pre_requisite_non_container_red_hat.yml @@ -46,7 +46,7 @@ state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" register: result until: result is succeeded - when: nfs_file_gw + when: nfs_file_gw | bool - name: install redhat nfs-ganesha-rgw and ceph-radosgw packages package: diff --git a/roles/ceph-nfs/templates/ceph-nfs.service.j2 b/roles/ceph-nfs/templates/ceph-nfs.service.j2 index 603ae12b3..921fb0b57 100644 --- a/roles/ceph-nfs/templates/ceph-nfs.service.j2 +++ b/roles/ceph-nfs/templates/ceph-nfs.service.j2 @@ -26,7 +26,7 @@ ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \ -v /var/run/ceph:/var/run/ceph:z \ -v /var/log/ceph:/var/log/ceph:z \ -v /var/log/ganesha:/var/log/ganesha:z \ - {% if ceph_nfs_dynamic_exports %} + {% if ceph_nfs_dynamic_exports | bool %} --privileged \ -v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket \ {% endif -%} diff --git a/roles/ceph-nfs/templates/ganesha.conf.j2 b/roles/ceph-nfs/templates/ganesha.conf.j2 index 9ac40126d..13c8a448b 100644 --- a/roles/ceph-nfs/templates/ganesha.conf.j2 +++ b/roles/ceph-nfs/templates/ganesha.conf.j2 @@ -1,7 +1,7 @@ #jinja2: trim_blocks: "true", lstrip_blocks: "true" # {{ ansible_managed }} -{% if ceph_nfs_dynamic_exports and not ceph_nfs_rados_backend %} +{% if ceph_nfs_dynamic_exports | bool and not ceph_nfs_rados_backend | bool %} %include /etc/ganesha/export.d/INDEX.conf {% endif %} @@ -12,7 +12,7 @@ NFS_Core_Param {% endif %} } -{% if ceph_nfs_disable_caching or nfs_file_gw %} +{% if ceph_nfs_disable_caching | bool or nfs_file_gw | bool %} EXPORT_DEFAULTS { Attr_Expiration_Time = 0; } @@ -25,7 +25,7 @@ CACHEINODE { } {% endif %} -{% if ceph_nfs_rados_backend %} +{% if ceph_nfs_rados_backend | bool %} RADOS_URLS { ceph_conf = '/etc/ceph/{{ cluster }}.conf'; userid = "{{ ceph_nfs_ceph_user }}"; @@ -42,7 +42,7 @@ RADOS_KV { } {% endif %} -{% if nfs_file_gw %} +{% if nfs_file_gw | bool %} EXPORT { Export_id={{ ceph_nfs_ceph_export_id }}; @@ -71,7 +71,7 @@ EXPORT {{ ganesha_ceph_export_overrides | default(None) }} } {% endif %} -{% if nfs_obj_gw %} +{% if nfs_obj_gw | bool %} EXPORT { Export_id={{ ceph_nfs_rgw_export_id }}; diff --git a/roles/ceph-osd/tasks/common.yml b/roles/ceph-osd/tasks/common.yml index 576b8991a..e1c156c4f 100644 --- a/roles/ceph-osd/tasks/common.yml +++ b/roles/ceph-osd/tasks/common.yml @@ -3,8 +3,8 @@ file: path: "{{ item }}" state: directory - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_directories_mode }}" when: cephx | bool with_items: @@ -27,8 +27,8 @@ copy: dest: "{{ item.item.path }}" content: "{{ item.stdout + '\n' }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_keyring_permissions }}" with_items: "{{ _osd_keys.results }}" when: diff --git a/roles/ceph-osd/tasks/openstack_config.yml b/roles/ceph-osd/tasks/openstack_config.yml index 6f31754d2..fbf4408e6 100644 --- a/roles/ceph-osd/tasks/openstack_config.yml +++ b/roles/ceph-osd/tasks/openstack_config.yml @@ -18,7 +18,7 @@ with_items: "{{ openstack_pools }}" delegate_to: "{{ groups[mon_group_name][0] }}" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" - name: create openstack cephx key(s) @@ -31,7 +31,7 @@ cluster: "{{ cluster }}" mode: "{{ item.mode|default(omit) }}" environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" with_items: "{{ openstack_keys }}" delegate_to: "{{ groups[mon_group_name][0] }}" @@ -47,8 +47,8 @@ copy: dest: "/etc/ceph/{{ cluster }}.{{ item.0.item.name }}.keyring" content: "{{ item.0.stdout + '\n' }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ item.0.item.mode }}" with_nested: - "{{ _osp_keys.results }}" diff --git a/roles/ceph-osd/tasks/scenarios/lvm-batch.yml b/roles/ceph-osd/tasks/scenarios/lvm-batch.yml index 0649c654f..2f30f3b24 100644 --- a/roles/ceph-osd/tasks/scenarios/lvm-batch.yml +++ b/roles/ceph-osd/tasks/scenarios/lvm-batch.yml @@ -16,7 +16,7 @@ action: "batch" environment: CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}" - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" PYTHONIOENCODING: utf-8 when: _devices | default([]) | length > 0 diff --git a/roles/ceph-osd/tasks/scenarios/lvm.yml b/roles/ceph-osd/tasks/scenarios/lvm.yml index 3ef5967f4..217df0c45 100644 --- a/roles/ceph-osd/tasks/scenarios/lvm.yml +++ b/roles/ceph-osd/tasks/scenarios/lvm.yml @@ -13,10 +13,10 @@ wal_vg: "{{ item.wal_vg|default(omit) }}" crush_device_class: "{{ item.crush_device_class|default(omit) }}" dmcrypt: "{{ dmcrypt|default(omit) }}" - action: "{{ 'prepare' if containerized_deployment else 'create' }}" + action: "{{ 'prepare' if containerized_deployment | bool else 'create' }}" environment: CEPH_VOLUME_DEBUG: "{{ ceph_volume_debug }}" - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" PYTHONIOENCODING: utf-8 with_items: "{{ lvm_volumes }}" diff --git a/roles/ceph-osd/tasks/start_osds.yml b/roles/ceph-osd/tasks/start_osds.yml index b3b99f4a6..3a8c82ae1 100644 --- a/roles/ceph-osd/tasks/start_osds.yml +++ b/roles/ceph-osd/tasks/start_osds.yml @@ -21,7 +21,7 @@ - name: set_fact docker_exec_start_osd set_fact: - docker_exec_start_osd: "{{ '{{ container_binary }} run --rm --net=host --privileged=true -v /var/run/udev/:/var/run/udev/:z -v /run/lvm/:/run/lvm/ -v /etc/ceph:/etc/ceph:z -v /dev:/dev --entrypoint=ceph-volume ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else 'ceph-volume' }}" + docker_exec_start_osd: "{{ '{{ container_binary }} run --rm --net=host --privileged=true -v /var/run/udev/:/var/run/udev/:z -v /run/lvm/:/run/lvm/ -v /etc/ceph:/etc/ceph:z -v /dev:/dev --entrypoint=ceph-volume ' + ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else 'ceph-volume' }}" - name: collect osd ids command: "{{ docker_exec_start_osd }} lvm list --format json" diff --git a/roles/ceph-rbd-mirror/tasks/common.yml b/roles/ceph-rbd-mirror/tasks/common.yml index e350808ae..e17427469 100644 --- a/roles/ceph-rbd-mirror/tasks/common.yml +++ b/roles/ceph-rbd-mirror/tasks/common.yml @@ -15,8 +15,8 @@ copy: dest: "{{ item.item.path }}" content: "{{ item.stdout + '\n' }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_keyring_permissions }}" with_items: "{{ _rbd_mirror_keys.results }}" when: diff --git a/roles/ceph-rgw/tasks/common.yml b/roles/ceph-rgw/tasks/common.yml index 5e0520c69..f4764294e 100644 --- a/roles/ceph-rgw/tasks/common.yml +++ b/roles/ceph-rgw/tasks/common.yml @@ -3,8 +3,8 @@ file: path: "{{ item }}" state: directory - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_directories_mode }}" with_items: "{{ rbd_client_admin_socket_path }}" @@ -24,8 +24,8 @@ copy: dest: "{{ item.item.path }}" content: "{{ item.stdout + '\n' }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: "{{ ceph_keyring_permissions }}" with_items: "{{ _rgw_keys.results }}" when: @@ -36,8 +36,8 @@ copy: content: "{{ radosgw_frontend_ssl_certificate_data }}" dest: "{{ radosgw_frontend_ssl_certificate }}" - owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}" - group: "{{ ceph_uid if containerized_deployment else 'ceph' }}" + owner: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" + group: "{{ ceph_uid if containerized_deployment | bool else 'ceph' }}" mode: 0440 when: radosgw_frontend_ssl_certificate | length > 0 and radosgw_frontend_ssl_certificate_data | length > 0 notify: restart ceph rgws diff --git a/roles/ceph-rgw/tasks/rgw_create_pools.yml b/roles/ceph-rgw/tasks/rgw_create_pools.yml index 7a11f4766..751512b6f 100644 --- a/roles/ceph-rgw/tasks/rgw_create_pools.yml +++ b/roles/ceph-rgw/tasks/rgw_create_pools.yml @@ -43,7 +43,7 @@ - item.value.type is defined - item.value.type == 'ec' environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" - name: create replicated pools for rgw @@ -61,5 +61,5 @@ delegate_to: "{{ groups[mon_group_name][0] }}" when: item.value.type is not defined or item.value.type == 'replicated' environment: - CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" + CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" diff --git a/roles/ceph-validate/tasks/check_nfs.yml b/roles/ceph-validate/tasks/check_nfs.yml index 99895dcbb..9f5b6ffde 100644 --- a/roles/ceph-validate/tasks/check_nfs.yml +++ b/roles/ceph-validate/tasks/check_nfs.yml @@ -3,7 +3,7 @@ fail: msg: "ceph_nfs_rgw_access_key and ceph_nfs_rgw_secret_key must be set if nfs_obj_gw is True" when: - - nfs_obj_gw + - nfs_obj_gw | bool - groups.get(mon_group_name, []) | length == 0 - (ceph_nfs_rgw_access_key is undefined or ceph_nfs_rgw_secret_key is undefined)