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 <dsavinea@redhat.com>
(cherry picked from commit 7f997e623a)
pull/5827/head
Dimitri Savineau 2020-01-16 09:38:08 -05:00 committed by Dimitri Savineau
parent 9412c44906
commit 1385d2fdd0
4 changed files with 15 additions and 52 deletions

View File

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

View File

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

View File

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

View File

@ -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, [])