-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.yml
258 lines (227 loc) · 5.28 KB
/
bootstrap.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
---
- hosts: all
become: true
tasks:
- name: Update kernel parameters
sysctl:
name: '{{ item.key }}'
value: '{{ item.value }}'
sysctl_set: yes
state: present
reload: yes
with_dict: '{{ sysctl_config }}'
ignore_errors: true
- name: Create a .ssh if it does not exist
ansible.builtin.file:
path: /home/debian/.ssh
state: directory
mode: '0700'
owner: debian
group: debian
- name: deploy ssh keys
template:
src: templates/authorized_keys
dest: /home/debian/.ssh/authorized_keys
owner: debian
group: debian
mode: 0600
- name: Install Packages
apt:
name:
- vim
- iputils-ping
- ifenslave
- ethtool
- lvm2
- htop
- iotop
- nload
- linux-cpupower
- chrony
- ipmitool
- nvme-cli
- bsd-mailx
- unattended-upgrades
state: present
update_cache: yes
- name: Use Japan pool for NTP
ansible.builtin.replace:
path: /etc/chrony/chrony.conf
regexp: 'pool 2.debian.pool.ntp.org iburst'
replace: 'pool 0.jp.pool.ntp.org iburst'
register: chrony
- name: Restart chrony
ansible.builtin.systemd:
state: restarted
name: chrony
enabled: yes
when: chrony.changed
- name: Set cpupower to performance
shell:
cmd: cpupower frequency-set -g schedutil
args:
executable: /bin/bash
ignore_errors: true
- name: Set congestion to bbr
include_role:
name: 'bbr'
- name: Deploy unattended-upgrades config
template:
src: templates/50unattended-upgrades.j2
dest: /etc/apt/apt.conf.d/50unattended-upgrades
owner: root
group: root
mode: 0644
- name: Redirect root emails to user@aaa.com in /etc/aliases
lineinfile:
path: /etc/aliases
line: "root: infra@cloudnative.tw"
state: present
- name: Run newaliases to apply changes
command: newaliases
- name: Deploy exim config
template:
src: templates/update-exim4.conf.conf.j2
dest: /etc/exim4/update-exim4.conf.conf
owner: root
group: root
mode: 0644
- name: Deploy root redirect config
template:
src: templates/050_custom_root_redirect
dest: /etc/exim4/conf.d/router/050_custom_root_redirect
owner: root
group: root
mode: 0644
- name: Deploy exim password
template:
src: templates/passwd.client.j2
dest: /etc/exim4/passwd.client
owner: root
group: root
mode: 0644
- name: Add mailname
copy:
content: "cloudnative.tw"
dest: /etc/mailname
force: true
- name: Update exim config
shell:
cmd: update-exim4.conf
args:
executable: /bin/bash
- name: Restart exim4
ansible.builtin.systemd:
state: restarted
name: exim4
enabled: yes
- hosts: compute
become: true
tasks:
- name: deploy resolved.conf template
template:
src: templates/resolved.conf.j2
dest: /etc/systemd/resolved.conf
owner: root
group: root
mode: 0644
- hosts: arm
become: true
tasks:
- name: Add debian User
ansible.builtin.user:
name: debian
shell: /bin/bash
groups: sudo
append: yes
- name: deploy sudoers file
template:
src: templates/100-ansible-users
dest: /etc/sudoers
owner: root
group: root
mode: 440
- name: Install Packages
apt:
name:
- locales
- locales-all
- pciutils
state: present
update_cache: yes
- name: Remove Python2
apt:
name:
- python
state: absent
update_cache: yes
- name: Make Python3 defualt
shell:
cmd: update-alternatives --install /usr/bin/python python /usr/bin/python3 2
args:
executable: /bin/bash
- name: deploy bond0 template
template:
src: templates/bond0.j2
dest: /etc/network/interfaces.d/bond0
owner: root
group: root
mode: 0644
register: bond0
- name: Restart network service for interface bond0
ansible.builtin.service:
name: networking
state: restarted
args:
- bond0
- bond0.1115
- bond0.100
- bond0.101
- bond0.1113
when: bond0.changed
- hosts: compute
become: true
tasks:
- name: deploy bond0 template
template:
src: templates/bond0.j2
dest: /etc/network/interfaces.d/bond0
owner: root
group: root
mode: 0644
register: bond0
- name: Restart network service for interface bond0
ansible.builtin.service:
name: networking
state: restarted
args:
- bond0
- bond0.1115
- bond0.100
- bond0.101
- bond0.1113
when: bond0.changed
- name: deploy kvm nested
template:
src: templates/nested.j2
dest: /etc/modprobe.d/kvm.conf
owner: root
group: root
mode: 0644
- hosts: cephadm
become: true
tasks:
- name: Download cephadm
get_url:
url: https://download.ceph.com/rpm-19.2.0/el9/noarch/cephadm
dest: /tmp/
mode: 0755
- name: Add Ceph Repo
shell: ./cephadm add-repo --release squid
args:
chdir: /tmp/
- name: Install Ceph Packates
become: true
shell: ./cephadm install
args:
chdir: /tmp/