-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_infra_on_openstack.yml
215 lines (192 loc) · 5.46 KB
/
create_infra_on_openstack.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
---
- hosts: localhost
tasks:
- name: Get the (first) public network
os_networks_info:
cloud: pctt
filters:
router:external: true
shared: true
status: "ACTIVE"
register: pubnet_result
when: quickstart_pubnet is not defined
- name: Create our network
os_network:
cloud: pctt
name: dci_quickstart
register: net_result
- name: Create our subnet
os_subnet:
cloud: pctt
name: dci_quickstart
network_name: dci_quickstart
cidr: 192.168.36.0/24
register: subnet_result
- name: Create our router
os_router:
cloud: pctt
name: dci_quickstart
interfaces:
- "{{ subnet_result.subnet.id }}"
network: "{% if quickstart_pubnet is defined %}{{ quickstart_pubnet }}{% else %}{{ pubnet_result.openstack_networks[0].id }}{% endif %}"
- name: Create a 100G volume for the feeder
os_volume:
cloud: pctt
size: 100
display_name: dci_quickstart_feeder
register: feeder_volume_result
- name: Create a 100G volume for the repo
os_volume:
cloud: pctt
size: 100
display_name: dci_quickstart_repo
register: repo_volume_result
- name: Create api server
os_server:
cloud: pctt
name: dci_quickstart_api
image: CentOS-Stream-GenericCloud-8-20220125.1
key_name: "{{ key_name }}"
flavor: m1.small
nics:
- net-id: "{{ net_result.network.id }}"
security_groups: default
auto_ip: true
- name: Create registry server
os_server:
cloud: pctt
name: dci_quickstart_registry
image: CentOS-7-x86_64-GenericCloud-2111
key_name: "{{ key_name }}"
flavor: m1.small
nics:
- net-id: "{{ net_result.network.id }}"
security_groups: default
auto_ip: true
- name: Create db server
os_server:
cloud: pctt
name: dci_quickstart_db
image: CentOS-7-x86_64-GenericCloud-2111
key_name: "{{ key_name }}"
flavor: m1.small
nics:
- net-id: "{{ net_result.network.id }}"
security_groups: default
auto_ip: true
- name: Create feeder server
os_server:
cloud: pctt
name: dci_quickstart_feeder
image: CentOS-7-x86_64-GenericCloud-2111
key_name: "{{ key_name }}"
flavor: m1.small
volumes:
- "{{ feeder_volume_result.volume.id }}"
nics:
- net-id: "{{ net_result.network.id }}"
security_groups: default
auto_ip: true
- name: Create repo server
os_server:
cloud: pctt
name: dci_quickstart_repo
image: CentOS-7-x86_64-GenericCloud-2111
key_name: "{{ key_name }}"
flavor: m1.small
volumes:
- "{{ repo_volume_result.volume.id }}"
nics:
- net-id: "{{ net_result.network.id }}"
security_groups: default
auto_ip: true
- name: Create monitoring server
os_server:
cloud: pctt
name: dci_quickstart_monitoring
image: CentOS-7-x86_64-GenericCloud-2111
key_name: "{{ key_name }}"
flavor: m1.small
nics:
- net-id: "{{ net_result.network.id }}"
security_groups: default
auto_ip: true
- name: Create blog server
os_server:
cloud: pctt
name: dci_quickstart_blog
image: CentOS-7-x86_64-GenericCloud-2111
key_name: "{{ key_name }}"
flavor: m1.small
nics:
- net-id: "{{ net_result.network.id }}"
security_groups: default
auto_ip: true
- name: Refresh inventory
meta: refresh_inventory
- hosts: dci_quickstart_feeder:dci_quickstart_repo
tasks:
- name: Create a partition on /dev/vdb
parted:
device: /dev/sdb
label: gpt
align: optimal
name: data
number: 1
part_start: "0%"
part_end: "100%"
state: present
become: yes
- name: Format partition on /dev/vdb
filesystem:
dev: /dev/sdb1
fstype: xfs
become: yes
- hosts: dci_quickstart_feeder
tasks:
- name: Ensure the mountpoint for feeder cache exists
file:
path: /var/cache/dci-feeder-api
state: directory
become: yes
- name: Mount the data partition onto the correct path
mount:
src: /dev/sdb1
fstype: xfs
path: /var/cache/dci-feeder-api
state: mounted
become: yes
- hosts: dci_quickstart_repo
tasks:
- name: Ensure the mountpoint for repo cache exists
file:
path: /repo
state: directory
become: yes
- name: Mount the data partition onto the correct path
mount:
src: /dev/sdb1
fstype: xfs
path: /repo
state: mounted
become: yes
- hosts: dci_quickstart*
tasks:
- name: Upgrade the ca-certificates package
package:
name: ca-certificates
state: latest
become: yes
- name: import key
rpm_key:
state: present
key: https://packages.distributed-ci.io/RPM-GPG-KEY-DCI-2024
become: yes
- name: Install dci-release
package:
name: https://packages.distributed-ci.io/dci-release.el{{ ansible_distribution_major_version }}.noarch.rpm
become: yes
- name: Install dci-sshpubkeys
package:
name: dci-sshpubkeys
become: yes