forked from batrick/ceph-linode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcephadm.yml
173 lines (143 loc) · 4.35 KB
/
cephadm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Copyright (C) 2020 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.---
- hosts: all
gather_facts: no
tasks:
- set_fact:
CEPHADM_IMAGE: ceph/daemon-base:latest-octopus-devel
CEPHADM_REPO: --dev octopus
- name: preconfigure linodes
import_playbook: pre-config.yml
- hosts: all
become: yes
tasks:
- name: fetch cephadm
become: no
delegate_to: localhost
register: cephadm
run_once: true
uri:
force: yes
mode: 0755
return_content: yes
url: https://github.com/ceph/ceph/raw/octopus/src/cephadm/cephadm
- name: distribute cephadm
copy:
dest: /root/cephadm
group: root
mode: 0755
owner: root
content: "{{ cephadm.content }}"
- name: create /etc/ceph directory
file:
path: /etc/ceph
state: directory
owner: root
group: root
mode: 0755
- hosts: mon-000
become: yes
tasks:
- name: add octopus repos
shell: /root/cephadm add-repo {{ CEPHADM_REPO }}
- name: install octopus
environment:
CEPHADM_IMAGE: "{{ CEPHADM_IMAGE }}"
shell: /root/cephadm install ceph-common
- name: check ceph installed
stat:
path: /etc/ceph/ceph.conf
register: ceph_installed
- name: bootstrap octopus
environment:
CEPHADM_IMAGE: "{{ CEPHADM_IMAGE }}"
shell: /root/cephadm bootstrap --allow-fqdn-hostname --mon-ip {{ monitor_address }}
when: not ceph_installed.stat.exists
- name: config public network
shell: ceph config set global public_network 192.168.0.0/16
- name: config cluster_network
shell: ceph config set global cluster_network 192.168.0.0/16
- name: log to files
shell: ceph config set global log_to_file true
- name: log cluster to file
shell: ceph config set global mon_cluster_log_to_file true
- name: disable stderr logging
shell: ceph config set global log_to_stderr false
- name: disable stderr logging of cluster log
shell: ceph config set global mon_cluster_log_to_stderr false
- hosts: mons mgrs osds mdss grafana-servers
become: yes
tasks:
- name: fetch ceph.pub
shell: cat /etc/ceph/ceph.pub
register: ceph_pub
delegate_to: mon-000
run_once: true
- name: register ceph.pub with hosts
lineinfile:
path: /root/.ssh/authorized_keys
line: "{{ ceph_pub.stdout }}"
- name: get hostname
shell: hostname --fqdn
register: myhostname
- name: add hostname to cephadm
shell: ceph orch host add "{{ myhostname.stdout }}" "{{ ansible_ssh_host }}"
delegate_to: mon-000
- name: label host
shell: ceph orch host label add "{{ myhostname.stdout }}" "{{ ceph_group }}"
delegate_to: mon-000
- hosts: mon-000
become: yes
tasks:
- name: use labeled mons
shell: ceph orch apply mon label:mons
- name: use labeled mgrs
shell: ceph orch apply mgr label:mgrs
- name: add osds
shell:
cmd: |
tee /dev/stderr <<EOF | ceph orch apply -i -
service_type: osd
service_id: default
placement:
label: osds
data_devices:
paths:
- /dev/sdc
EOF
- name: use labeled mdss
shell: ceph orch apply mds all --placement=label:mdss
- hosts: all
become: yes
tasks:
- name: generate min config
shell: ceph config generate-minimal-conf
delegate_to: mon-000
register: minimal_config
run_once: true
- name: setup config
copy:
# yay ansible bug: https://github.com/ansible/ansible/issues/6077
content: "{{ minimal_config.stdout }}\n"
dest: /etc/ceph/ceph.conf
owner: root
group: root
mode: 0644
- hosts: clients
become: yes
tasks:
- name: add octopus repos
shell: /root/cephadm add-repo {{ CEPHADM_REPO }}
- name: install octopus
shell: /root/cephadm install ceph-common ceph-fuse