From: Dimitri Savineau Date: Mon, 21 Sep 2020 15:07:43 +0000 (-0400) Subject: facts: refact `ceph_uid` fact X-Git-Tag: v3.2.51~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de98f9ab8e5535fa6ebe0035c3b538396cd3463f;p=ceph-ansible.git facts: refact `ceph_uid` fact There's no need to set this fact with a set_fact We can achieve this in ceph-defaults Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1875058 Signed-off-by: Dimitri Savineau --- diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 923f20043..d01bfacc6 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -285,6 +285,8 @@ dummy: #ceph_conf_key_directory: /etc/ceph +#ceph_uid: "{{ '64045' if not containerized_deployment | bool and ansible_os_family == 'Debian' else '167' }}" + # Permissions for keyring files in /etc/ceph #ceph_keyring_permissions: '0600' diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index f42f3db39..28987015e 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -285,6 +285,8 @@ ceph_rhcs_version: 3 #ceph_conf_key_directory: /etc/ceph +#ceph_uid: "{{ '64045' if not containerized_deployment | bool and ansible_os_family == 'Debian' else '167' }}" + # Permissions for keyring files in /etc/ceph #ceph_keyring_permissions: '0600' diff --git a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml index 20175165b..4e5a5beee 100644 --- a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml +++ b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml @@ -90,21 +90,6 @@ state: stopped enabled: no - - name: set_fact ceph_uid for ubuntu - set_fact: - ceph_uid: 64045 - when: ceph_docker_image_tag | string is search("ubuntu") - - - name: set_fact ceph_uid for red hat - set_fact: - ceph_uid: 167 - when: ceph_docker_image_tag | string is match("latest") or ceph_docker_image_tag | string is search("centos") or ceph_docker_image_tag | string is search("fedora") - - - name: set_fact ceph_uid for rhel - set_fact: - ceph_uid: 167 - when: ceph_docker_image is search("rhceph") - # NOTE: changed from file module to raw find command for performance reasons # The file module has to run checks on current ownership of all directories and files. This is unnecessary # as in this case we know we want all owned by ceph user @@ -173,14 +158,6 @@ enabled: no failed_when: false - - set_fact: - ceph_uid: 64045 - when: ceph_docker_image_tag | string is match("latest") or ceph_docker_image_tag | string is search("ubuntu") - - - set_fact: - ceph_uid: 167 - when: ceph_docker_image_tag | string is search("centos") or ceph_docker_image is search("rhceph") or ceph_docker_image_tag | string is search("fedora") - # NOTE: changed from file module to raw find command for performance reasons # The file module has to run checks on current ownership of all directories and files. This is unnecessary # as in this case we know we want all owned by ceph user @@ -281,20 +258,6 @@ shell: 'sgdisk --partition-guid=5:$(uuidgen) {{ item.stdout[:-2] if item.stdout is match("^/dev/(cciss|nvme|loop).*") else item.stdout[:-1] }}' with_items: '{{ lockbox_devices.results }}' - - set_fact: - ceph_uid: 64045 - when: ceph_docker_image_tag | string is match("latest") or ceph_docker_image_tag | string is search("ubuntu") - - - name: set_fact ceph_uid for red hat - set_fact: - ceph_uid: 167 - when: ceph_docker_image_tag | string is match("latest") or ceph_docker_image_tag | string is search("centos") or ceph_docker_image_tag | string is search("fedora") - - - name: set_fact ceph_uid for rhel - set_fact: - ceph_uid: 167 - when: ceph_docker_image is search("rhceph") - # NOTE: changed from file module to raw find command for performance reasons # The file module has to run checks on current ownership of all directories and files. This is unnecessary # as in this case we know we want all owned by ceph user @@ -396,14 +359,6 @@ state: stopped enabled: no - - set_fact: - ceph_uid: 64045 - when: ceph_docker_image_tag | string is match("latest") or ceph_docker_image_tag | string is search("ubuntu") - - - set_fact: - ceph_uid: 167 - when: ceph_docker_image_tag | string is search("centos") or ceph_docker_image is search("rhceph") or ceph_docker_image_tag | string is search("fedora") - # NOTE: changed from file module to raw find command for performance reasons # The file module has to run checks on current ownership of all directories and files. This is unnecessary # as in this case we know we want all owned by ceph user @@ -438,14 +393,6 @@ state: stopped enabled: no - - set_fact: - ceph_uid: 64045 - when: ceph_docker_image_tag | string is match("latest") or ceph_docker_image_tag | string is search("ubuntu") - - - set_fact: - ceph_uid: 167 - when: ceph_docker_image_tag | string is search("centos") or ceph_docker_image is search("rhceph") or ceph_docker_image_tag | string is search("fedora") - # NOTE: changed from file module to raw find command for performance reasons # The file module has to run checks on current ownership of all directories and files. This is unnecessary # as in this case we know we want all owned by ceph user @@ -480,14 +427,6 @@ state: stopped enabled: no - - set_fact: - ceph_uid: 64045 - when: ceph_docker_image_tag | string is match("latest") or ceph_docker_image_tag | string is search("ubuntu") - - - set_fact: - ceph_uid: 167 - when: ceph_docker_image_tag | string is search("centos") or ceph_docker_image is search("rhceph") or ceph_docker_image_tag | string is search("fedora") - # NOTE: changed from file module to raw find command for performance reasons # The file module has to run checks on current ownership of all directories and files. This is unnecessary # as in this case we know we want all owned by ceph user @@ -526,14 +465,6 @@ enabled: no failed_when: false - - set_fact: - ceph_uid: 64045 - when: ceph_docker_image_tag | string is match("latest") or ceph_docker_image_tag | string is search("ubuntu") - - - set_fact: - ceph_uid: 167 - when: ceph_docker_image_tag | string is search("centos") or ceph_docker_image is search("rhceph") or ceph_docker_image_tag | string is search("fedora") - # NOTE: changed from file module to raw find command for performance reasons # The file module has to run checks on current ownership of all directories and files. This is unnecessary # as in this case we know we want all owned by ceph user diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index 0833421e0..bc3cfdac5 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -277,6 +277,8 @@ generate_fsid: true ceph_conf_key_directory: /etc/ceph +ceph_uid: "{{ '64045' if not containerized_deployment | bool and ansible_os_family == 'Debian' else '167' }}" + # Permissions for keyring files in /etc/ceph ceph_keyring_permissions: '0600' diff --git a/roles/ceph-facts/tasks/facts.yml b/roles/ceph-facts/tasks/facts.yml index 9235b9f6a..0cb638b2f 100644 --- a/roles/ceph-facts/tasks/facts.yml +++ b/roles/ceph-facts/tasks/facts.yml @@ -195,41 +195,6 @@ - item.value.holders|count == 0 - item.key is not match osd_auto_discovery_exclude -- name: set_fact ceph_uid for debian based system - non container - set_fact: - ceph_uid: 64045 - when: - - not containerized_deployment - - ansible_os_family == 'Debian' - -- name: set_fact ceph_uid for red hat or suse based system - non container - set_fact: - ceph_uid: 167 - when: - - not containerized_deployment - - ansible_os_family in ['RedHat', 'Suse'] - -- name: set_fact ceph_uid for debian based system - container - set_fact: - ceph_uid: 64045 - when: - - containerized_deployment - - ceph_docker_image_tag | string is search("ubuntu") - -- name: set_fact ceph_uid for red hat based system - container - set_fact: - ceph_uid: 167 - when: - - containerized_deployment - - ceph_docker_image_tag | string is search("latest") or ceph_docker_image_tag | string is search("centos") or ceph_docker_image_tag | string is search("fedora") - -- name: set_fact ceph_uid for red hat - set_fact: - ceph_uid: 167 - when: - - containerized_deployment - - ceph_docker_image is search("rhceph") - - name: set_fact rgw_hostname set_fact: rgw_hostname: "{% set _value = ansible_hostname -%}