-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.yaml
201 lines (180 loc) · 5.96 KB
/
main.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
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
---
- name: Deploy cert-manager
kubernetes.core.k8s:
state: present
src: https://github.com/jetstack/cert-manager/releases/download/{{ cert_manager_version }}/cert-manager.yaml
- name: Wait for cert-manager
kubernetes.core.k8s_info:
api_version: apps/v1
kind: Deployment
name: cert-manager-webhook
namespace: cert-manager
register: cert_manager_status
until: >-
cert_manager_status.resources[0].status.conditions |
selectattr('type', 'equalto', 'Available') |
selectattr('status', 'equalto', 'True') |
list | length > 0
retries: "{{ medium_retries | int }}"
delay: "{{ medium_delay | int }}"
- name: Show PATH
ansible.builtin.debug:
msg: "PATH: {{ ansible_env.PATH }}"
- name: Deploy ironic
kubernetes.core.k8s:
definition: "{{ lookup('kubernetes.core.kustomize', dir=playbook_dir + '/../../test/e2e/manifests/ironic') }}"
state: present
apply: true
- name: Wait for ironic
kubernetes.core.k8s_info:
api_version: apps/v1
kind: Deployment
name: ironic
namespace: baremetal-operator-system
register: ironic_status
until: >-
ironic_status.resources[0].status.conditions |
selectattr('type', 'equalto', 'Available') |
selectattr('status', 'equalto', 'True') |
list | length > 0
retries: "{{ medium_retries | int }}"
delay: "{{ medium_delay | int }}"
- name: Deploy BMO
kubernetes.core.k8s:
definition: "{{ lookup('kubernetes.core.kustomize', dir=playbook_dir + '/../../test/e2e/manifests/bmo') }}"
state: present
apply: true
- name: Wait for BMO
kubernetes.core.k8s_info:
api_version: apps/v1
kind: Deployment
name: baremetal-operator-controller-manager
namespace: baremetal-operator-system
register: bmo_status
until: >-
bmo_status.resources[0].status.conditions |
selectattr('type', 'equalto', 'Available') |
selectattr('status', 'equalto', 'True') |
list | length > 0
retries: "{{ medium_retries | int }}"
delay: "{{ medium_delay | int }}"
- name: Deploy MetalLB
kubernetes.core.k8s:
state: present
src: https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml
- name: Wait for MetalLB
kubernetes.core.k8s_info:
api_version: apps/v1
kind: Deployment
name: controller
namespace: metallb-system
register: metallb_status
until: >-
metallb_status.resources[0].status.conditions |
selectattr('type', 'equalto', 'Available') |
selectattr('status', 'equalto', 'True') |
list | length > 0
retries: "{{ medium_retries | int }}"
delay: "{{ medium_delay | int }}"
- name: Deploy metallb IPAddressPool
kubernetes.core.k8s:
src: "{{ src_dir }}/test/e2e/manifests/metallb/metallb.yaml"
state: present
apply: true
- name: Create nginx-ingress namespace
kubernetes.core.k8s:
api_version: v1
kind: Namespace
name: nginx-ingress
state: present
- name: Deploy nginx-ingress
kubernetes.core.k8s:
state: present
src: "{{ src_dir }}/test/e2e/manifests/ingress-nginx/nginx.yaml"
apply: true
- name: Wait for load balancer IP
kubernetes.core.k8s_info:
api_version: v1
kind: Service
name: ingress-nginx-controller
namespace: nginx-ingress
register: lb_status
until: lb_status.resources[0].status.loadBalancer.ingress is defined
retries: "{{ medium_retries | int }}"
delay: "{{ medium_delay | int }}"
- name: Save load balancer IP
ansible.builtin.copy:
content: "{{ lb_status.resources[0].status.loadBalancer.ingress[0].ip }}"
dest: /tmp/loadbalancer_ip
mode: '0644'
- name: Deploy infrastructure operator
kubernetes.core.k8s:
definition: "{{ lookup('kubernetes.core.kustomize', dir=playbook_dir + '/../../test/e2e/manifests/infrastructure-operator') }}"
state: present
apply: true
- name: Deploy agent service config
kubernetes.core.k8s:
state: present
src: "{{ src_dir }}/test/e2e/manifests/infrastructure-operator/agentconfig.yaml"
- name: Wait for assisted-service
kubernetes.core.k8s_info:
api_version: apps/v1
kind: Deployment
name: assisted-service
namespace: assisted-installer
register: assisted_service_status
until: >-
assisted_service_status.resources is defined and
assisted_service_status.resources | length > 0 and
assisted_service_status.resources[0].status.conditions |
selectattr('type', 'equalto', 'Available') |
selectattr('status', 'equalto', 'True') |
list |
length > 0
retries: "{{ medium_retries | int }}"
delay: "{{ medium_delay | int }}"
- name: Wait for assisted-image-service
kubernetes.core.k8s_info:
api_version: v1
kind: Pod
name: assisted-image-service-0
namespace: assisted-installer
register: image_service_status
until: >-
image_service_status.resources is defined and
image_service_status.resources | length > 0 and
image_service_status.resources[0].status.conditions |
selectattr('type', 'equalto', 'Ready') |
selectattr('status', 'equalto', 'True') |
list |
length > 0
retries: "{{ medium_retries | int }}"
delay: "{{ medium_delay | int }}"
- name: Install clusterctl
ansible.builtin.get_url:
url: "https://github.com/kubernetes-sigs/cluster-api/releases/download/{{ capi_version }}/clusterctl-linux-amd64"
dest: /usr/local/bin/clusterctl
mode: '0755'
- name: Deploy CAPI
ansible.builtin.command: "clusterctl init --core cluster-api:{{ capi_version }} --bootstrap - --control-plane - --infrastructure metal3:{{ capm3_version }}"
changed_when: true
- name: Copy distfiles
ansible.builtin.copy:
src: "{{ dist_dir }}"
dest: "/tmp"
mode: '0644'
- name: Set imagePullPolicy for CAPBCOA
ansible.builtin.replace:
path: "{{ item }}"
regexp: 'imagePullPolicy: Always'
replace: 'imagePullPolicy: Never'
loop:
- /tmp/dist/bootstrap_install.yaml
- /tmp/dist/controlplane_install.yaml
- name: Deploy CAPBCOA
kubernetes.core.k8s:
state: present
src: "{{ item }}"
loop:
- /tmp/controlplane_install.yaml
- /tmp/bootstrap_install.yaml