2015-01-30 23:16:18 +08:00
|
|
|
---
|
2017-03-17 05:31:25 +08:00
|
|
|
- name: collect admin and bootstrap keys
|
2017-01-17 20:13:43 +08:00
|
|
|
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-03-17 05:31:25 +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
|
2017-05-05 16:44:58 +08:00
|
|
|
failed_when: false
|
2016-12-16 18:42:17 +08:00
|
|
|
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
|
2017-03-16 17:17:08 +08:00
|
|
|
- groups.get(restapi_group_name, []) | length > 0
|
|
|
|
- inventory_hostname == groups[mon_group_name]|last
|
|
|
|
|
|
|
|
- name: create ceph mgr keyring(s) when mon is not containerized
|
2017-04-20 22:17:45 +08:00
|
|
|
command: ceph --cluster {{ cluster }} auth get-or-create mgr.{{ hostvars[item]['ansible_hostname'] }} mon 'allow profile mgr' osd 'allow *' mds 'allow *' -o /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring
|
2017-03-16 17:17:08 +08:00
|
|
|
args:
|
|
|
|
creates: /etc/ceph/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring
|
|
|
|
changed_when: false
|
|
|
|
when:
|
|
|
|
- cephx
|
|
|
|
- groups.get(mgr_group_name, []) | length > 0
|
|
|
|
- inventory_hostname == groups[mon_group_name]|last
|
2017-05-04 17:14:58 +08:00
|
|
|
- ceph_release_num.{{ ceph_release }} > ceph_release_num.jewel
|
2017-04-11 20:20:11 +08:00
|
|
|
with_items: "{{ groups.get(mgr_group_name, []) }}"
|
2016-01-22 03:54:41 +08:00
|
|
|
|
2017-02-24 17:22:16 +08:00
|
|
|
- include: set_osd_pool_default_pg_num.yml
|
2016-12-05 21:21:54 +08:00
|
|
|
|
2017-01-03 20:48:59 +08:00
|
|
|
- name: test if rbd exists
|
2017-04-13 04:07:10 +08:00
|
|
|
command: ceph --cluster {{ cluster }} osd pool get rbd size
|
2017-01-03 20:48:59 +08:00
|
|
|
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
|
2017-02-24 17:22:16 +08:00
|
|
|
when:
|
|
|
|
- openstack_config
|
2017-03-24 14:40:15 +08:00
|
|
|
- "{{ inventory_hostname == groups[mon_group_name] | last }}"
|
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-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
|
2017-03-16 17:17:08 +08:00
|
|
|
when:
|
|
|
|
- cephx
|
|
|
|
- inventory_hostname == groups[mon_group_name]|last
|
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'
|