-
-
Save farcaller/de151908fee17b07c1e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# {{ ansible_managed }} | |
[global] | |
fsid = {{ ceph_fsid }} | |
mon initial members = {{ monitor.hostname }} | |
mon host = {{ monitor.addr }} | |
auth cluster required = cephx | |
auth service required = cephx | |
auth client required = cephx | |
osd pool default size = 2 | |
osd pool default min size = 1 | |
osd pool default pg num = 128 | |
osd pool default pgp num = 128 | |
osd crush chooseleaf type = 1 | |
[osd] | |
osd journal size = 100 | |
filestore xattr use omap = false | |
osd mkfs type = {{ osd.fs_type }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ceph -s | |
cluster 91604ba3-8d24-4f07-a567-d84dc688d6a2 | |
health HEALTH_WARN 88 pgs degraded; 192 pgs stuck unclean | |
monmap e1: 1 mons at {master=127.0.0.1:6789/0}, election epoch 2, quorum 0 master | |
osdmap e10: 2 osds: 2 up, 2 in | |
pgmap v17: 192 pgs, 3 pools, 0 bytes data, 0 objects | |
70152 kB used, 1998 GB / 1998 GB avail | |
88 active+degraded | |
104 active+remapped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: add ceph gpg key | |
apt_key: url={{ ceph_gpg_key }} state=present | |
# - name: "add ceph extras repo" | |
# apt_repository: repo='deb {{ ceph_repo_mirror }}/packages/ceph-extras/debian {{ ansible_lsb.codename }} main' state=present | |
- name: add ceph repo | |
apt_repository: repo='deb {{ ceph_repo_mirror }}/debian-{{ ceph_release }}/ {{ ansible_lsb.codename }} main' state=present | |
# ' | |
- name: update apt cache | |
apt: update-cache=yes | |
- name: install ceph packages | |
apt: pkg={{ item }} state=latest | |
with_items: | |
- ceph | |
- ceph-common | |
- ceph-fs-common | |
- ceph-fuse | |
- ceph-mds | |
- libcephfs1 | |
- name: generate ceph configuration file | |
template: src=roles/ceph/templates/ceph.conf.j2 dest=/etc/ceph/ceph.conf owner=root group=root mode=0644 | |
- name: create administrator keyring | |
command: ceph-authtool --create-keyring {{ keyrings.administrator }} -a {{ ceph_secrets.administrator }} -n client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow' creates={{ keyrings.administrator }} | |
- name: create temporary monitor keyring | |
command: ceph-authtool --create-keyring {{ keyrings.temp_monitor }} -a {{ ceph_secrets.monitor }} -n mon. --cap mon 'allow *' creates={{ keyrings.temp_monitor }} | |
- name: import administrator keyring into temporary monitor keyring | |
command: ceph-authtool {{ keyrings.temp_monitor }} --import-keyring {{ keyrings.administrator }} | |
- name: create temporary monitor map | |
command: monmaptool --create --add {{ monitor.hostname }} {{ monitor.addr }} --fsid {{ ceph_fsid }} {{ monitor.temp_monmap }} creates={{ monitor.temp_monmap }} | |
- name: create monitor data directory | |
file: path="/var/lib/ceph/mon/{{ ceph_cluster_name }}-{{ monitor.hostname }}" state=directory mode=0700 | |
# " | |
- name: populate monitor with map and keyring | |
command: ceph-mon --mkfs -i {{ monitor.hostname }} --monmap {{ monitor.temp_monmap }} --keyring {{ keyrings.temp_monitor }} creates="/var/lib/ceph/mon/{{ ceph_cluster_name }}-{{ monitor.hostname }}/keyring" | |
- name: remove temporary configs | |
file: path={{ item }} state=absent | |
with_items: | |
- "{{ monitor.temp_monmap }}" | |
- "{{ keyrings.temp_monitor }}" | |
- name: start ceph-mon | |
service: name=ceph-mon state=started arguments="id={{ monitor.hostname }}" | |
# " | |
- name: prepare osd disks | |
command: ceph-disk prepare --cluster {{ ceph_cluster_name }} --cluster-uuid {{ ceph_fsid }} --fs-type {{ osd.fs_type }} {{ item }} | |
with_items: osd.devices | |
ignore_errors: True | |
changed_when: False | |
- name: activate osds | |
command: ceph-disk activate {{ item }} | |
with_items: osd.devices | |
ignore_errors: True | |
changed_when: False | |
- name: enable all ceph services | |
service: name=ceph-all state=started enabled=yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment