ceph-ansible/roles/ceph-common/tasks/facts.yml

122 lines
3.1 KiB
YAML
Raw Normal View History

---
- name: get ceph version
command: ceph --version
changed_when: false
always_run: yes
register: ceph_version
- name: is ceph running already?
command: ceph --connect-timeout 3 --cluster {{ cluster }} fsid
changed_when: false
failed_when: false
always_run: yes
register: ceph_current_fsid
delegate_to: "{{ groups[mon_group_name][0] }}"
- set_fact:
fsid: "{{ ceph_current_fsid.stdout }}"
when: ceph_current_fsid.rc == 0
- set_fact:
ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}"
# NOTE(mattt): On ansible 2.x we can use ansible_service_mgr instead
- name: check init system
slurp:
src: /proc/1/comm
always_run: yes
register: init_system
- set_fact:
init_system={{ init_system.content | b64decode | trim }}
- set_fact:
use_systemd={{ init_system.strip() == 'systemd' }}
- set_fact:
mds_name: "{{ ansible_hostname }}"
when: not mds_use_fqdn
- set_fact:
mds_name: "{{ ansible_fqdn }}"
when: mds_use_fqdn
- set_fact:
dir_owner: ceph
dir_group: ceph
dir_mode: "0755"
when: ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer
- set_fact:
dir_owner: root
dir_group: root
dir_mode: "0755"
when: ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis
- set_fact:
key_owner: root
key_group: root
key_mode: "0600"
when: ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis
- set_fact:
key_owner: ceph
key_group: ceph
key_mode: "0600"
when: ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer
- set_fact:
activate_file_owner: ceph
activate_file_group: ceph
activate_file_mode: "0644"
when: ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer
- set_fact:
activate_file_owner: root
activate_file_group: root
activate_file_mode: "0644"
when: ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis
- set_fact:
rbd_client_directory_owner: root
when:
- ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis
- rbd_client_directory_owner is not defined
or not rbd_client_directory_owner
- set_fact:
rbd_client_directory_owner: ceph
when:
- ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer
- rbd_client_directory_owner is not defined
or not rbd_client_directory_owner
- set_fact:
rbd_client_directory_group: root
when:
- ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis
- rbd_client_directory_group is not defined
or not rbd_client_directory_group
- set_fact:
rbd_client_directory_group: ceph
when:
- ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer
- rbd_client_directory_group is not defined
or not rbd_client_directory_group
- set_fact:
rbd_client_directory_mode: "1777"
when:
- ceph_release_num.{{ ceph_release }} < ceph_release_num.infernalis
- rbd_client_directory_mode is not defined
or not rbd_client_directory_mode
- set_fact:
rbd_client_directory_mode: "0770"
when:
- ceph_release_num.{{ ceph_release }} > ceph_release_num.hammer
- rbd_client_directory_mode is not defined
or not rbd_client_directory_mode