2015-01-30 23:16:18 +08:00
|
|
|
---
|
2017-01-17 20:13:43 +08:00
|
|
|
- name: collect admin and bootstrap keys (for or after kraken release)
|
|
|
|
command: ceph-create-keys --cluster {{ cluster }} -i {{ monitor_name }}
|
|
|
|
args:
|
|
|
|
creates: /etc/ceph/{{ cluster }}.client.admin.keyring
|
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
|
|
|
always_run: true
|
|
|
|
when:
|
|
|
|
- cephx
|
2017-02-10 21:58:15 +08:00
|
|
|
- ceph_release_num.{{ ceph_release }} > ceph_release_num.jewel
|
2017-01-17 20:13:43 +08:00
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
# NOTE (leseb): wait for mon discovery and quorum resolution
|
2016-05-09 15:12:01 +08:00
|
|
|
# the admin key is not instantaneously created so we have to wait a bit
|
2016-12-15 04:08:18 +08:00
|
|
|
- name: "wait for {{ cluster }}.client.admin.keyring exists"
|
2015-10-17 07:55:31 +08:00
|
|
|
wait_for:
|
2016-03-29 21:37:31 +08:00
|
|
|
path: /etc/ceph/{{ cluster }}.client.admin.keyring
|
2016-04-01 03:23:12 +08:00
|
|
|
when: cephx
|
2015-01-30 23:16:18 +08:00
|
|
|
|
2016-12-16 18:42:17 +08:00
|
|
|
- name: test if initial mon keyring is in mon kv store
|
|
|
|
command: ceph --cluster {{ cluster }} config-key get initial_mon_keyring
|
|
|
|
changed_when: false
|
2017-01-03 20:48:59 +08:00
|
|
|
ignore_errors: true
|
2016-12-16 18:42:17 +08:00
|
|
|
always_run: true
|
|
|
|
run_once: true
|
|
|
|
register: is_initial_mon_keyring_in_kv
|
|
|
|
|
|
|
|
- name: put initial mon keyring in mon kv store
|
|
|
|
command: ceph --cluster {{ cluster }} config-key put initial_mon_keyring {{ monitor_keyring.stdout }}
|
|
|
|
changed_when: false
|
|
|
|
always_run: true
|
|
|
|
run_once: true
|
2017-01-02 18:16:03 +08:00
|
|
|
when:
|
|
|
|
- is_initial_mon_keyring_in_kv.rc != 0
|
|
|
|
- cephx
|
2016-12-16 18:42:17 +08:00
|
|
|
|
2016-01-22 03:54:41 +08:00
|
|
|
- name: create ceph rest api keyring when mon is not containerized
|
2016-03-29 21:37:31 +08:00
|
|
|
command: ceph --cluster {{ cluster }} auth get-or-create client.restapi osd 'allow *' mon 'allow *' -o /etc/ceph/{{ cluster }}.client.restapi.keyring
|
2015-10-17 07:55:31 +08:00
|
|
|
args:
|
2016-03-29 21:37:31 +08:00
|
|
|
creates: /etc/ceph/{{ cluster }}.client.restapi.keyring
|
2015-06-26 06:26:03 +08:00
|
|
|
changed_when: false
|
|
|
|
when:
|
2016-05-09 22:08:33 +08:00
|
|
|
- cephx
|
|
|
|
- groups[restapi_group_name] is defined
|
2016-01-22 03:54:41 +08:00
|
|
|
|
2016-12-05 21:21:54 +08:00
|
|
|
# NOTE(leseb): we add a conditional for backward compatibility
|
|
|
|
# so people that had 'pool_default_pg_num' declared will get
|
|
|
|
# the same behaviour
|
|
|
|
#
|
|
|
|
- name: check if does global key exist in ceph_conf_overrides
|
|
|
|
set_fact:
|
|
|
|
global_in_ceph_conf_overrides: "{{ 'global' in ceph_conf_overrides }}"
|
|
|
|
|
|
|
|
- name: check if ceph_conf_overrides.global.osd_pool_default_pg_num is set
|
|
|
|
set_fact:
|
|
|
|
osd_pool_default_pg_num_in_overrides: "{{ 'osd_pool_default_pg_num' in ceph_conf_overrides.global }}"
|
|
|
|
when: global_in_ceph_conf_overrides
|
|
|
|
|
|
|
|
- name: get default value for osd_pool_default_pg_num
|
|
|
|
shell: |
|
|
|
|
ceph --cluster {{ cluster }} daemon mon.{{ monitor_name }} config get osd_pool_default_pg_num | grep -Po '(?<="osd_pool_default_pg_num": ")[^"]*'
|
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
|
|
|
run_once: true
|
|
|
|
register: default_pool_default_pg_num
|
|
|
|
when: (pool_default_pg_num is not defined or not global_in_ceph_conf_overrides)
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
osd_pool_default_pg_num: "{{ pool_default_pg_num }}"
|
|
|
|
when: pool_default_pg_num is defined
|
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
osd_pool_default_pg_num: "{{ default_pool_default_pg_num.stdout }}"
|
|
|
|
when:
|
|
|
|
- pool_default_pg_num is not defined
|
|
|
|
- default_pool_default_pg_num.rc == 0
|
2017-02-08 17:45:09 +08:00
|
|
|
- (osd_pool_default_pg_num_in_overrides is not defined or not osd_pool_default_pg_num_in_overrides)
|
2016-12-05 21:21:54 +08:00
|
|
|
|
|
|
|
- set_fact:
|
|
|
|
osd_pool_default_pg_num: "{{ ceph_conf_overrides.global.osd_pool_default_pg_num }}"
|
2017-02-09 17:54:49 +08:00
|
|
|
when:
|
|
|
|
- global_in_ceph_conf_overrides
|
|
|
|
- ceph_conf_overrides.global.osd_pool_default_pg_num is defined
|
2016-12-05 21:21:54 +08:00
|
|
|
|
2017-01-03 20:48:59 +08:00
|
|
|
- name: test if rbd exists
|
|
|
|
command: ceph --cluster {{ cluster }} osd pool stats rbd
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: rbd_pool_exist
|
|
|
|
|
2016-10-21 00:19:19 +08:00
|
|
|
- include: rbd_pool.yml
|
2017-01-03 20:48:59 +08:00
|
|
|
when: rbd_pool_exist.rc == 0
|
|
|
|
|
|
|
|
- include: rbd_pool_pgs.yml
|
|
|
|
when:
|
|
|
|
- rbd_pool_exist.rc == 0
|
2017-02-09 17:54:49 +08:00
|
|
|
- global_in_ceph_conf_overrides
|
2017-01-03 20:48:59 +08:00
|
|
|
- ceph_conf_overrides.global.osd_pool_default_pg_num is defined
|
|
|
|
|
|
|
|
- include: rbd_pool_size.yml
|
|
|
|
when:
|
|
|
|
- rbd_pool_exist.rc == 0
|
2017-02-09 17:54:49 +08:00
|
|
|
- global_in_ceph_conf_overrides
|
2017-01-03 20:48:59 +08:00
|
|
|
- ceph_conf_overrides.global.osd_pool_default_size is defined
|
2016-10-21 00:19:19 +08:00
|
|
|
|
2015-01-30 23:16:18 +08:00
|
|
|
- include: openstack_config.yml
|
2016-02-27 05:39:27 +08:00
|
|
|
when: openstack_config
|
2015-01-30 23:16:18 +08:00
|
|
|
|
2015-07-24 02:01:43 +08:00
|
|
|
- name: find ceph keys
|
2015-01-30 23:16:18 +08:00
|
|
|
shell: ls -1 /etc/ceph/*.keyring
|
2015-06-26 06:26:03 +08:00
|
|
|
changed_when: false
|
2015-01-30 23:16:18 +08:00
|
|
|
register: ceph_keys
|
2016-11-24 18:54:10 +08:00
|
|
|
always_run: true
|
2015-01-30 23:16:18 +08:00
|
|
|
when: cephx
|
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: set keys permissions
|
2015-10-17 07:55:31 +08:00
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
2017-01-20 17:14:35 +08:00
|
|
|
owner: "ceph"
|
|
|
|
group: "ceph"
|
|
|
|
mode: "0600"
|
2015-03-23 22:08:58 +08:00
|
|
|
with_items:
|
2016-12-14 08:48:14 +08:00
|
|
|
- "{{ ceph_keys.get('stdout_lines') | default([]) }}"
|
2016-02-24 01:33:03 +08:00
|
|
|
when: cephx
|
2015-03-23 22:08:58 +08:00
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: copy keys to the ansible server
|
2015-10-17 07:55:31 +08:00
|
|
|
fetch:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
|
|
|
|
flat: yes
|
2015-12-04 23:31:17 +08:00
|
|
|
run_once: true
|
2015-01-30 23:16:18 +08:00
|
|
|
with_items:
|
2016-12-14 08:48:14 +08:00
|
|
|
- "{{ ceph_keys.get('stdout_lines') | default([]) }}"
|
2016-03-29 21:37:31 +08:00
|
|
|
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
|
|
|
|
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
|
|
|
|
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
|
2015-06-26 06:26:03 +08:00
|
|
|
when: cephx
|
2015-01-30 23:16:18 +08:00
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
- name: drop in a motd script to report status when logging in
|
2015-10-17 07:55:31 +08:00
|
|
|
copy:
|
|
|
|
src: precise/92-ceph
|
|
|
|
dest: /etc/update-motd.d/92-ceph
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
2015-01-30 23:16:18 +08:00
|
|
|
when: ansible_distribution_release == 'precise'
|