From 1385d2fdd09a1ec182fbf3611821d4af05a70a88 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Thu, 16 Jan 2020 09:38:08 -0500 Subject: [PATCH] ceph-facts: move facts to defaults value There's no need to define a variable via a fact if we can do it via a default value. Using a fact could be interesseting to override the default value on some condition. - ceph_uid could be set to 167 by default because it's only different on non containerized deployment on Debian/Ubuntu. - rbd_client_directory_{owner,group,mode} could be set to ceph,ceph,0770 by default install of null as we are doing in the facts. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1875058 Signed-off-by: Dimitri Savineau (cherry picked from commit 7f997e623a7171fa6f00c43cd5b60f3882f8ed04) --- group_vars/all.yml.sample | 8 +++-- group_vars/rhcs.yml.sample | 8 +++-- roles/ceph-defaults/defaults/main.yml | 8 +++-- roles/ceph-facts/tasks/facts.yml | 43 --------------------------- 4 files changed, 15 insertions(+), 52 deletions(-) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 354331c8d..c07ad158a 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -255,6 +255,8 @@ dummy: #ceph_conf_key_directory: /etc/ceph +#ceph_uid: 167 + # Permissions for keyring files in /etc/ceph #ceph_keyring_permissions: '0600' @@ -294,9 +296,9 @@ dummy: # 'rbd_client_directory_mode: "0755"', *not* # 'rbd_client_directory_mode: 0755', or Ansible will complain: mode # must be in octal or symbolic form -#rbd_client_directory_owner: null -#rbd_client_directory_group: null -#rbd_client_directory_mode: null +#rbd_client_directory_owner: ceph +#rbd_client_directory_group: ceph +#rbd_client_directory_mode: "0770" #rbd_client_log_path: /var/log/ceph #rbd_client_log_file: "{{ rbd_client_log_path }}/qemu-guest-$pid.log" # must be writable by QEMU and allowed by SELinux or AppArmor diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index c92e148a5..f3d23cd0e 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -255,6 +255,8 @@ ceph_iscsi_config_dev: false #ceph_conf_key_directory: /etc/ceph +#ceph_uid: 167 + # Permissions for keyring files in /etc/ceph #ceph_keyring_permissions: '0600' @@ -294,9 +296,9 @@ ceph_iscsi_config_dev: false # 'rbd_client_directory_mode: "0755"', *not* # 'rbd_client_directory_mode: 0755', or Ansible will complain: mode # must be in octal or symbolic form -#rbd_client_directory_owner: null -#rbd_client_directory_group: null -#rbd_client_directory_mode: null +#rbd_client_directory_owner: ceph +#rbd_client_directory_group: ceph +#rbd_client_directory_mode: "0770" #rbd_client_log_path: /var/log/ceph #rbd_client_log_file: "{{ rbd_client_log_path }}/qemu-guest-$pid.log" # must be writable by QEMU and allowed by SELinux or AppArmor diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index 9813c39e3..1873530f0 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -247,6 +247,8 @@ generate_fsid: true ceph_conf_key_directory: /etc/ceph +ceph_uid: 167 + # Permissions for keyring files in /etc/ceph ceph_keyring_permissions: '0600' @@ -286,9 +288,9 @@ rbd_client_directories: true # this will create rbd_client_log_path and rbd_clie # 'rbd_client_directory_mode: "0755"', *not* # 'rbd_client_directory_mode: 0755', or Ansible will complain: mode # must be in octal or symbolic form -rbd_client_directory_owner: null -rbd_client_directory_group: null -rbd_client_directory_mode: null +rbd_client_directory_owner: ceph +rbd_client_directory_group: ceph +rbd_client_directory_mode: "0770" rbd_client_log_path: /var/log/ceph rbd_client_log_file: "{{ rbd_client_log_path }}/qemu-guest-$pid.log" # must be writable by QEMU and allowed by SELinux or AppArmor diff --git a/roles/ceph-facts/tasks/facts.yml b/roles/ceph-facts/tasks/facts.yml index f67bbe46a..602c88bd4 100644 --- a/roles/ceph-facts/tasks/facts.yml +++ b/roles/ceph-facts/tasks/facts.yml @@ -197,24 +197,6 @@ mds_name: "{{ ansible_fqdn }}" when: mds_use_fqdn | bool -- name: set_fact rbd_client_directory_owner ceph - set_fact: - rbd_client_directory_owner: ceph - when: rbd_client_directory_owner is not defined - or not rbd_client_directory_owner - -- name: set_fact rbd_client_directory_group rbd_client_directory_group - set_fact: - rbd_client_directory_group: ceph - when: rbd_client_directory_group is not defined - or not rbd_client_directory_group - -- name: set_fact rbd_client_directory_mode 0770 - set_fact: - rbd_client_directory_mode: "0770" - when: rbd_client_directory_mode is not defined - or not rbd_client_directory_mode - - name: resolve device link(s) command: readlink -f {{ item }} changed_when: false @@ -263,31 +245,6 @@ - not containerized_deployment | bool - 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 | bool - - ansible_os_family in ['RedHat', 'Suse'] - -- name: set_fact ceph_uid for debian based system - container - set_fact: - ceph_uid: 64045 - when: - - containerized_deployment | bool - - 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 | bool - - (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") - or ceph_docker_image_tag | string is search("rhceph") - or (ansible_distribution == 'RedHat')) - - name: backward compatibility tasks related when: - inventory_hostname in groups.get(rgw_group_name, [])