71 lines
2.4 KiB
YAML
71 lines
2.4 KiB
YAML
---
|
|
- name: install ceph utilities
|
|
apt:
|
|
name: "{{item}}"
|
|
loop:
|
|
- ceph
|
|
- ceph-mds
|
|
- lvm2
|
|
- name: setup ceph monitor
|
|
block:
|
|
- name: configure ceph monitor host
|
|
template:
|
|
src: ceph.conf.j2
|
|
dest: /etc/ceph/ceph.conf
|
|
- name: create ceph mon keyring
|
|
command:
|
|
cmd: ceph-authtool --create-keyring /etc/ceph/ceph.mon.keyring --gen-key -n mon. --cap mon 'allow *'
|
|
args:
|
|
creates: /etc/ceph/ceph.mon.keyring
|
|
notify: import keyring to admin
|
|
- name: create ceph admin keyring
|
|
command:
|
|
cmd: ceph-authtool --create-keyring /etc/ceph/ceph.client.admin.keyring --gen-key -n client.admin --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow *' --cap mgr 'allow *'
|
|
args:
|
|
creates: /etc/ceph/ceph.client.admin.keyring
|
|
- name: create ceph bootstrap-osd keyring
|
|
command:
|
|
cmd: ceph-authtool --create-keyring /var/lib/ceph/bootstrap-osd/ceph.keyring --gen-key -n client.bootstrap-osd --cap mon 'profile bootstrap-osd' --cap mgr 'allow r'
|
|
args:
|
|
creates: /var/lib/ceph/bootstrap-osd/ceph.keyring
|
|
notify: import keyring to osd
|
|
- name: flush handlers
|
|
meta: flush_handlers
|
|
- name: change ownership of mon keyring
|
|
file:
|
|
path: /etc/ceph/ceph.mon.keyring
|
|
owner: ceph
|
|
group: ceph
|
|
- name: generate monitor map
|
|
shell:
|
|
cmd: monmaptool --create --add {{ansible_nodename}} {{wg_ip}} --fsid {{'zkntceph'|to_uuid}} /etc/ceph/monmap
|
|
args:
|
|
creates: /etc/ceph/monmap
|
|
- name: create data directory
|
|
file:
|
|
path: /var/lib/ceph/mon/ceph-{{ansible_nodename}}
|
|
state: directory
|
|
owner: ceph
|
|
group: ceph
|
|
- name: populate monitor daemon
|
|
command:
|
|
cmd: ceph-mon --mkfs -i {{ansible_nodename}} --monmap /etc/ceph/monmap --keyring /etc/ceph/ceph.mon.keyring
|
|
args:
|
|
creates: /var/lib/ceph/mon/ceph-{{ansible_nodename}}kv_backend
|
|
become_user: ceph
|
|
- name: start and enable ceph-mon
|
|
systemd:
|
|
name: ceph-mon@node01
|
|
enabled: yes
|
|
state: started
|
|
when: ansible_hostname == "node01"
|
|
- name: set up ceph manager
|
|
block:
|
|
- name: create authentication key
|
|
shell:
|
|
cmd: ceph auth get-or-create mgr.{{ansible_nodename}} mon 'allow profile mgr' osd 'allow *' mds 'allow *' > /var/lib/ceph/mgr/ceph-{{ansible_nodename}}
|
|
args:
|
|
creates: /var/lib/ceph/mgr/ceph-{{ansible_nodename}}
|
|
when: ansible_hostname == "node01"
|
|
|