2014-03-04 02:08:51 +08:00
|
|
|
---
|
|
|
|
## Deploy Ceph monitor(s)
|
|
|
|
#
|
|
|
|
|
|
|
|
- name: Create monitor initial keyring
|
2014-03-12 20:31:22 +08:00
|
|
|
command: ceph-authtool /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }} --create-keyring --name=mon. --add-key={{ monitor_secret }} --cap mon 'allow *' creates=/var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }}
|
2014-03-04 02:08:51 +08:00
|
|
|
|
|
|
|
- name: Set initial monitor key permissions
|
|
|
|
file: path=/var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }} mode=0600 owner=root group=root
|
|
|
|
|
|
|
|
- name: Create monitor directory
|
2014-03-11 07:47:24 +08:00
|
|
|
file: path=/var/lib/ceph/mon/ceph-{{ ansible_hostname }} state=directory owner=root group=root mode=0644
|
2014-03-04 02:08:51 +08:00
|
|
|
|
|
|
|
- name: Ceph monitor mkfs
|
|
|
|
command: ceph-mon --mkfs -i {{ ansible_hostname }} --keyring /var/lib/ceph/tmp/keyring.mon.{{ ansible_hostname }} creates=/var/lib/ceph/mon/ceph-{{ ansible_hostname }}/keyring
|
|
|
|
|
|
|
|
- name: Start and add that the monitor service to the init sequence
|
|
|
|
service: name=ceph state=started enabled=yes args=mon
|
|
|
|
|
|
|
|
# Wait for mon discovery and quorum resolution
|
|
|
|
# the admin key is not instantanely created so we have to wait a bit
|
|
|
|
#
|
|
|
|
|
|
|
|
- name: If client.admin key exists
|
|
|
|
command: stat /etc/ceph/ceph.client.admin.keyring
|
|
|
|
register: result
|
|
|
|
until: result.rc == 0
|
|
|
|
changed_when: False
|
|
|
|
|
2014-03-06 20:54:37 +08:00
|
|
|
- name: Create RGW keyring
|
|
|
|
command: ceph auth get-or-create client.radosgw.gateway osd 'allow rwx' mon 'allow rw' -o /etc/ceph/keyring.radosgw.gateway creates=/etc/ceph/keyring.radosgw.gateway
|
|
|
|
when: cephx and radosgw
|
|
|
|
changed_when: False
|
|
|
|
|
2014-03-04 02:08:51 +08:00
|
|
|
- name: Copy keys to the ansible server
|
|
|
|
fetch: src={{ item }} dest=fetch/
|
2014-03-12 22:05:42 +08:00
|
|
|
when: ansible_fqdn == hostvars[groups['mons'][0]]['ansible_fqdn'] and cephx
|
2014-03-04 02:08:51 +08:00
|
|
|
with_items:
|
|
|
|
- /etc/ceph/ceph.client.admin.keyring # just in case another application needs it
|
|
|
|
- /var/lib/ceph/bootstrap-osd/ceph.keyring # this handles the non-colocation case
|
|
|
|
- /var/lib/ceph/bootstrap-mds/ceph.keyring
|
2014-03-06 20:54:37 +08:00
|
|
|
- /etc/ceph/keyring.radosgw.gateway
|