2016-04-27 21:17:56 +08:00
|
|
|
---
|
|
|
|
- name: get ceph version
|
|
|
|
command: ceph --version
|
|
|
|
changed_when: false
|
2016-11-17 05:47:43 +08:00
|
|
|
always_run: yes
|
2016-04-27 21:17:56 +08:00
|
|
|
register: ceph_version
|
|
|
|
|
2016-12-06 22:59:49 +08:00
|
|
|
- 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
|
2016-12-09 03:16:02 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2016-12-06 22:59:49 +08:00
|
|
|
|
2016-12-08 23:58:22 +08:00
|
|
|
- name: create a local fetch directory if it does not exist
|
|
|
|
local_action: file path={{ fetch_directory }} state=directory
|
|
|
|
changed_when: false
|
|
|
|
become: false
|
|
|
|
run_once: true
|
|
|
|
when: cephx or generate_fsid
|
|
|
|
|
2016-12-06 22:59:49 +08:00
|
|
|
- set_fact:
|
|
|
|
fsid: "{{ ceph_current_fsid.stdout }}"
|
|
|
|
when: ceph_current_fsid.rc == 0
|
|
|
|
|
2016-12-08 23:58:22 +08:00
|
|
|
- set_fact:
|
|
|
|
monitor_name: "{{ ansible_hostname }}"
|
|
|
|
when: not mon_use_fqdn
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
monitor_name: "{{ ansible_fqdn }}"
|
|
|
|
when: mon_use_fqdn
|
|
|
|
|
|
|
|
# We want this check to be run only on one mon
|
|
|
|
- name: check if {{ fetch_directory }} directory exists
|
|
|
|
local_action: stat path="{{ fetch_directory }}/monitor_keyring.conf"
|
2016-12-16 18:36:42 +08:00
|
|
|
become: false
|
2016-12-08 23:58:22 +08:00
|
|
|
register: monitor_keyring_conf
|
|
|
|
run_once: true
|
|
|
|
|
2016-12-16 23:24:48 +08:00
|
|
|
- include: facts_mon_fsid.yml
|
2016-12-08 23:58:22 +08:00
|
|
|
run_once: true
|
|
|
|
when:
|
|
|
|
- not monitor_keyring_conf.stat.exists
|
|
|
|
- ceph_current_fsid.rc == 0
|
|
|
|
- mon_group_name in group_names
|
|
|
|
|
2016-04-27 21:17:56 +08:00
|
|
|
- set_fact:
|
|
|
|
ceph_version: "{{ ceph_version.stdout.split(' ')[2] }}"
|
|
|
|
|
2016-05-04 18:47:24 +08:00
|
|
|
# NOTE(mattt): On ansible 2.x we can use ansible_service_mgr instead
|
|
|
|
- name: check init system
|
|
|
|
slurp:
|
|
|
|
src: /proc/1/comm
|
2016-11-17 05:47:43 +08:00
|
|
|
always_run: yes
|
2016-05-04 18:47:24 +08:00
|
|
|
register: init_system
|
|
|
|
|
|
|
|
- set_fact:
|
2016-06-29 05:54:34 +08:00
|
|
|
init_system={{ init_system.content | b64decode | trim }}
|
2016-05-04 18:47:24 +08:00
|
|
|
|
2016-05-05 01:16:27 +08:00
|
|
|
- set_fact:
|
2016-05-06 22:14:06 +08:00
|
|
|
use_systemd={{ init_system.strip() == 'systemd' }}
|
2016-05-05 01:16:27 +08:00
|
|
|
|
2016-05-09 06:36:15 +08:00
|
|
|
- set_fact:
|
|
|
|
mds_name: "{{ ansible_hostname }}"
|
|
|
|
when: not mds_use_fqdn
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
mds_name: "{{ ansible_fqdn }}"
|
|
|
|
when: mds_use_fqdn
|
2016-12-09 21:51:35 +08:00
|
|
|
|
|
|
|
- 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
|
|
|
|
|