]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
facts: refact `ceph_uid` fact
authorDimitri Savineau <dsavinea@redhat.com>
Mon, 21 Sep 2020 15:07:43 +0000 (11:07 -0400)
committerDimitri Savineau <savineau.dimitri@gmail.com>
Mon, 21 Sep 2020 17:49:12 +0000 (13:49 -0400)
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 <dsavinea@redhat.com>
group_vars/all.yml.sample
group_vars/rhcs.yml.sample
infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml
roles/ceph-defaults/defaults/main.yml
roles/ceph-facts/tasks/facts.yml

index 923f20043fc10f89d6e21cc8c516db13346b0efe..d01bfacc6e845306bcdfefbb598cba45e50172ae 100644 (file)
@@ -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'
 
index f42f3db39e5d75e1d611ef1991c494bdae412560..28987015e45db8c1b701c1926d2d009e62ae68b9 100644 (file)
@@ -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'
 
index 20175165b3d728e291cffad35c0fe0610e802630..4e5a5beee9a8ae224cc9dd3a5c6c0fb9c8f07c27 100644 (file)
         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
         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
           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
         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
         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
         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
         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
index 0833421e040325b151c1f349a19a3ee7e565153e..bc3cfdac5da0721638edfd7f4daf90909d5b3c57 100644 (file)
@@ -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'
 
index 9235b9f6a9f1e0420e489cfbee76c1361a7704bf..0cb638b2f9e8fc178269b44bf03696bbe11f7152 100644 (file)
     - 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 -%}