blob: 0f3ad60cf7bdf4aa8b8574b0ad5a13eb90698c05 (
plain)
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
|
---
- include_vars: "{{ ansible_os_family }}.yml"
- name: copy rsa secret key from compass-core to host1
copy: src=/root/.ssh/id_rsa dest=/root/.ssh/id_rsa mode=0600
- name: copy rsa pub key from compass-core to host1
copy: src=/root/.ssh/id_rsa.pub dest=/root/.ssh/id_rsa.pub mode=0644
- name: gen ssh key for no-ask access to every nodes
shell: if [ ! -f ~/.ssh/id_rsa.pub ]; then ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N ""; else echo "already gen ssh key!"; fi;
- name: copy key to node
shell: ssh-copy-id -i ~/.ssh/id_rsa.pub -o StrictHostKeyChecking=no root@{{ item }}
with_items:
- "{{ groups['all'] }}"
- name: install ceph-related packages
action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
with_items: packages | union(packages_noarch)
- name: clear cluster_hosts_name
file: path=cluster_hosts_name state=absent
tags:
- create_ceph_cluster
- ceph_install
- name: clear cluster_controller_nodes
file: path=cluster_controller_nodes state=absent
tags:
- create_ceph_cluster
- ceph_install
- name: clear ceph_mon_nodes
file: path=ceph_mon_nodes state=absent
tags:
- create_ceph_cluster
- ceph_install
- name: echo hosts name to file
shell: echo -n "{{ item }} " >> cluster_hosts_name
with_items:
- "{{ groups['all'] }}"
tags:
- create_ceph_cluster
- ceph_install
- name: register hosts name
shell: cat cluster_hosts_name
register: ceph_cluster_hosts
tags:
- create_ceph_cluster
- echo_hosts
- ceph_install
- name: echo controller name to file
shell: echo -n "{{ item }} " >> cluster_controller_nodes
with_items:
- "{{ groups['controller'] }}"
tags:
- create_ceph_cluster
- ceph_install
- name: register controller nodes
shell: cat cluster_controller_nodes
register: controller_nodes
tags:
- create_ceph_cluster
- echo_hosts
- ceph_install
- name: echo ceph-mon name to file
shell: echo -n "{{ item }} " >> ceph_mon_nodes
with_items:
- "{{ groups['ceph_mon'] }}"
tags:
- create_ceph_cluster
- ceph_install
- name: register ceph-mon nodes
shell: cat ceph_mon_nodes
register: mon_nodes
tags:
- create_ceph_cluster
- echo_hosts
- ceph_install
- name: gen clean ceph script
template: src=clean_ceph.j2 dest=~/clean_ceph.sh mode=0777
- name: clean ceph data of last deploy
shell: ~/clean_ceph.sh
- name: mkdir for ceph-cluster
file: path={{ ceph_cluster_dir[0] }} state=directory mode=0755
|