2015-01-30 23:16:18 +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
|
|
|
|
failed_when: false
|
|
|
|
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-10-21 00:19:19 +08:00
|
|
|
- include: rbd_pool.yml
|
|
|
|
when: ceph_conf_overrides.global.osd_pool_default_pg_num is defined
|
|
|
|
|
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 }}"
|
2016-04-04 06:36:59 +08:00
|
|
|
mode: "{{ key_mode }}"
|
|
|
|
owner: "{{ key_owner }}"
|
|
|
|
group: "{{ key_group }}"
|
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'
|