2015-01-30 23:16:18 +08:00
|
|
|
---
|
2018-10-24 00:38:40 +08:00
|
|
|
- name: waiting for the monitor(s) to form the quorum...
|
2018-11-16 17:50:38 +08:00
|
|
|
command: >
|
|
|
|
{{ docker_exec_cmd }}
|
|
|
|
ceph
|
|
|
|
--cluster {{ cluster }}
|
|
|
|
-n mon.
|
|
|
|
-k /var/lib/ceph/mon/{{ cluster }}-{{ ansible_hostname }}/keyring
|
|
|
|
mon_status
|
|
|
|
--format json
|
2018-10-24 00:38:40 +08:00
|
|
|
register: ceph_health_raw
|
2018-11-16 17:50:38 +08:00
|
|
|
run_once: true
|
2018-10-24 00:38:40 +08:00
|
|
|
until: >
|
2018-12-04 16:59:47 +08:00
|
|
|
(ceph_health_raw.stdout | default('{}') | from_json)['state'] in ['leader', 'peon']
|
2018-10-24 00:38:40 +08:00
|
|
|
retries: "{{ handler_health_mon_check_retries }}"
|
|
|
|
delay: "{{ handler_health_mon_check_delay }}"
|
|
|
|
|
2018-11-16 17:50:38 +08:00
|
|
|
- name: fetch ceph initial keys
|
2018-10-24 00:38:40 +08:00
|
|
|
ceph_key:
|
|
|
|
state: fetch_initial_keys
|
|
|
|
cluster: "{{ cluster }}"
|
2018-11-16 17:50:38 +08:00
|
|
|
owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
|
|
|
|
group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
|
|
|
|
mode: "0400"
|
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
2018-10-24 00:38:40 +08:00
|
|
|
when:
|
2017-07-01 02:04:51 +08:00
|
|
|
- cephx
|
|
|
|
|
2018-11-16 17:50:38 +08:00
|
|
|
- block:
|
|
|
|
- name: create ceph mgr keyring(s)
|
|
|
|
ceph_key:
|
|
|
|
name: "mgr.{{ hostvars[item]['ansible_hostname'] }}"
|
|
|
|
state: present
|
|
|
|
caps:
|
|
|
|
mon: allow profile mgr
|
|
|
|
osd: allow *
|
|
|
|
mds: allow *
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
secret: "{{ (mgr_secret != 'mgr_secret') | ternary(mgr_secret, omit) }}"
|
|
|
|
owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
|
|
|
|
group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
|
|
|
|
mode: "0400"
|
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
|
|
|
with_items:
|
|
|
|
- "{{ groups.get(mgr_group_name, []) }}" # this honors the condition where mgrs run on separate machines
|
|
|
|
- "{{ groups.get(mon_group_name, []) }}" # this honors the new rule where mgrs are always collocated with mons
|
2015-01-30 23:16:18 +08:00
|
|
|
|
2018-11-16 17:50:38 +08:00
|
|
|
- name: copy ceph mgr key(s) to the ansible server
|
|
|
|
fetch:
|
|
|
|
src: "{{ ceph_conf_key_directory }}/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring"
|
|
|
|
dest: "{{ fetch_directory }}/{{ fsid }}/{{ ceph_conf_key_directory }}/{{ cluster }}.mgr.{{ hostvars[item]['ansible_hostname'] }}.keyring"
|
|
|
|
flat: yes
|
|
|
|
with_items:
|
|
|
|
- "{{ groups.get(mgr_group_name, []) }}"
|
|
|
|
when:
|
|
|
|
- groups.get(mgr_group_name, []) | length > 0
|
2017-09-15 06:48:53 +08:00
|
|
|
when:
|
|
|
|
- cephx
|
2018-11-16 17:50:38 +08:00
|
|
|
- not rolling_update
|
|
|
|
- inventory_hostname == groups[mon_group_name]|last # only on the last to avoid key creation collision
|
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-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
|
2018-11-06 00:14:31 +08:00
|
|
|
- /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring
|
|
|
|
- /var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring
|
2018-11-16 17:50:38 +08:00
|
|
|
- /etc/ceph/{{ cluster }}.client.admin.keyring
|
2017-03-16 17:17:08 +08:00
|
|
|
when:
|
|
|
|
- cephx
|
2017-09-15 06:48:53 +08:00
|
|
|
- inventory_hostname == groups[mon_group_name] | last
|