-
Notifications
You must be signed in to change notification settings - Fork 17
/
bootstrap-ceph.yaml
110 lines (85 loc) · 2.13 KB
/
bootstrap-ceph.yaml
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
---
- hosts: "node"
gather_facts: true
tasks:
- file:
path: "/var/lib/ceph"
state: "directory"
mode: "0755"
sudo: true
- file:
path: "/etc/ceph/scripts"
state: "directory"
mode: "0755"
sudo: true
- lineinfile:
create: yes
state: "present"
dest: "/etc/modules-load.d/ceph.conf"
line: "ceph"
sudo: true
- modprobe:
state: "present"
name: "ceph"
sudo: true
- copy:
src: "templates/rbd.sh"
dest: "/opt/bin/rbd"
mode: "755"
sudo: true
- hosts: "node[0]"
gather_facts: true
tasks:
- template:
src: "templates/ceph.conf.j2"
dest: "/etc/ceph/ceph.conf"
sudo: true
- template:
src: "templates/ceph-mds-entrypoint.sh.j2"
dest: "/etc/ceph/scripts/mds-entrypoint.sh"
mode: "0755"
sudo: true
- template:
src: "templates/ceph-bootstrap.sh.j2"
dest: "/etc/ceph/scripts/bootstrap.sh"
sudo: true
- template:
src: "templates/ceph-monmap.sh.j2"
dest: "/etc/ceph/scripts/monmap.sh"
sudo: true
- command: "docker run --rm -v /etc/ceph:/etc/ceph -v /var/lib/ceph:/var/lib/ceph --net=host --entrypoint /bin/bash ceph/base /etc/ceph/scripts/bootstrap.sh"
args:
creates: "/etc/ceph/ceph.client.admin.keyring"
- command: "docker run --rm -v /etc/ceph:/etc/ceph --net=host ceph/base 'bash /etc/ceph/scripts/monmap.sh'"
- file:
path: "tmp/ceph"
state: "directory"
delegate_to: "localhost"
- synchronize:
src: "/etc/ceph/"
dest: "tmp/ceph"
mode: "pull"
sudo: true
- command: "cat /etc/ceph/admin.secret"
register: "admin_key"
- hosts: "node[1-99999]"
gather_facts: true
tasks:
- synchronize:
src: "tmp/ceph/"
dest: "/etc/ceph"
sudo: true
- hosts: "node"
gather_facts: false
tasks:
- set_fact:
admin_key: "{{hostvars[groups.node[0]].admin_key.stdout}}"
- template:
src: "templates/ceph-environment.j2"
dest: "/etc/ceph-environment"
sudo: true
- copy:
src: "templates/cephfs-mount.sh"
dest: "/opt/bin/cephfs-mount"
mode: "755"
sudo: true