|
29 | 29 | no_log: true |
30 | 30 |
|
31 | 31 | - name: Create podman secret for ironic htpasswd |
| 32 | + become: "{{ metal3_persistent | default(false) | bool }}" |
32 | 33 | containers.podman.podman_secret: |
33 | 34 | name: metal3-ironic-htpasswd |
34 | 35 | data: "{{ metal3_ironic_htpasswd }}" |
|
42 | 43 |
|
43 | 44 | - name: Create podman secret for CA bundle |
44 | 45 | when: ssl_certs_configured | bool |
| 46 | + become: "{{ metal3_persistent | default(false) | bool }}" |
45 | 47 | containers.podman.podman_secret: |
46 | 48 | name: metal3-ca-bundle |
47 | 49 | data: "{{ sslIngressCertificateFullChain + sslCACertificate | default('') }}" |
|
50 | 52 | no_log: true |
51 | 53 |
|
52 | 54 | - name: Create ironic-conf volume |
| 55 | + become: "{{ metal3_persistent | default(false) | bool }}" |
53 | 56 | containers.podman.podman_volume: |
54 | 57 | name: metal3-ironic-conf |
55 | 58 | state: present |
56 | 59 |
|
57 | 60 | - name: Create ironic-data volume |
| 61 | + become: "{{ metal3_persistent | default(false) | bool }}" |
58 | 62 | containers.podman.podman_volume: |
59 | 63 | name: metal3-ironic-data |
60 | 64 | state: present |
61 | 65 |
|
62 | 66 | - name: Create ironic-shared volume |
| 67 | + become: "{{ metal3_persistent | default(false) | bool }}" |
63 | 68 | containers.podman.podman_volume: |
64 | 69 | name: metal3-ironic-shared |
65 | 70 | state: present |
66 | 71 |
|
67 | | -- name: Create metal3-ironic pod |
68 | | - containers.podman.podman_pod: |
69 | | - name: metal3-ironic |
70 | | - network: host |
71 | | - share: net,ipc,uts |
72 | | - state: started |
73 | | - |
74 | | -- name: Wait for metal3-ironic pod infrastructure container to be ready |
75 | | - block: |
76 | | - - name: Get pod info to extract infra container ID |
77 | | - containers.podman.podman_pod_info: |
78 | | - name: metal3-ironic |
79 | | - register: r_pod_infra_check |
80 | | - retries: 30 |
81 | | - delay: 2 |
82 | | - until: |
83 | | - - r_pod_infra_check.pods | length > 0 |
84 | | - - r_pod_infra_check.pods[0].InfraContainerID is defined |
85 | | - - r_pod_infra_check.pods[0].InfraContainerID | length > 0 |
86 | | - changed_when: false |
87 | | - |
88 | | - - name: Verify infra container is running |
89 | | - containers.podman.podman_container_info: |
90 | | - name: "{{ r_pod_infra_check.pods[0].InfraContainerID }}" |
91 | | - register: r_infra_container_check |
92 | | - retries: 10 |
93 | | - delay: 1 |
94 | | - until: |
95 | | - - r_infra_container_check.containers | length > 0 |
96 | | - - r_infra_container_check.containers[0].State.Running | default(false) |
97 | | - changed_when: false |
98 | | - |
99 | | -- name: Wait for metal3-ironic pod to exist |
100 | | - containers.podman.podman_pod_info: |
101 | | - name: metal3-ironic |
102 | | - register: r_pod_infra_check |
103 | | - retries: 30 |
104 | | - delay: 2 |
105 | | - until: |
106 | | - - r_pod_infra_check.pods | length > 0 |
107 | | - changed_when: false |
108 | | - |
109 | | -- name: Set ironic secrets list (with CA bundle) |
110 | | - when: ssl_certs_configured | bool |
111 | | - ansible.builtin.set_fact: |
112 | | - ironic_secrets: |
113 | | - - metal3-ca-bundle,type=mount,target=/certs/ca-bundle.crt,uid=1002,gid=1003,mode=0400 |
114 | | - - metal3-ironic-htpasswd,type=env,target=IRONIC_HTPASSWD |
| 72 | +- name: Pre-pull ironic image |
| 73 | + become: "{{ metal3_persistent | default(false) | bool }}" |
| 74 | + containers.podman.podman_image: |
| 75 | + name: "{{ metal3_ironic_image }}" |
| 76 | + auth_file: "{{ pullSecretPath }}" |
| 77 | + state: present |
115 | 78 |
|
116 | | -- name: Set ironic secrets list (without CA bundle) |
117 | | - when: not (ssl_certs_configured | bool) |
118 | | - ansible.builtin.set_fact: |
119 | | - ironic_secrets: |
120 | | - - metal3-ironic-htpasswd,type=env,target=IRONIC_HTPASSWD |
| 79 | +- name: Deploy Ironic containers (ephemeral) |
| 80 | + when: not (metal3_persistent | default(false) | bool) |
| 81 | + ansible.builtin.include_tasks: deploy_ironic_containers.yaml |
121 | 82 |
|
122 | | -- name: Set ironic environment variables (with CA bundle) |
123 | | - when: ssl_certs_configured | bool |
124 | | - ansible.builtin.set_fact: |
125 | | - ironic_env: |
126 | | - IRONIC_LISTEN_PORT: "6385" |
127 | | - HTTP_PORT: "6180" |
128 | | - LISTEN_ALL_INTERFACES: "true" |
129 | | - USE_IRONIC_INSPECTOR: "false" |
130 | | - PROVISIONING_IP: "{{ lzBmcIP }}" |
131 | | - IRONIC_USE_MARIADB: "false" |
132 | | - IRONIC_EXPOSE_JSON_RPC: "false" |
133 | | - OS_JSON_RPC__PORT: "6189" |
134 | | - WEBSERVER_CACERT_FILE: /certs/ca-bundle.crt |
135 | | - |
136 | | -- name: Set ironic environment variables (without CA bundle) |
137 | | - when: not (ssl_certs_configured | bool) |
138 | | - ansible.builtin.set_fact: |
139 | | - ironic_env: |
140 | | - IRONIC_LISTEN_PORT: "6385" |
141 | | - HTTP_PORT: "6180" |
142 | | - LISTEN_ALL_INTERFACES: "true" |
143 | | - USE_IRONIC_INSPECTOR: "false" |
144 | | - PROVISIONING_IP: "{{ lzBmcIP }}" |
145 | | - IRONIC_USE_MARIADB: "false" |
146 | | - IRONIC_EXPOSE_JSON_RPC: "false" |
147 | | - OS_JSON_RPC__PORT: "6189" |
148 | | - |
149 | | -- name: Run ironic container |
150 | | - containers.podman.podman_container: |
151 | | - name: ironic |
152 | | - pod: metal3-ironic |
153 | | - image: "{{ metal3_ironic_image }}" |
154 | | - authfile: "{{ pullSecretPath }}" |
155 | | - restart_policy: always |
156 | | - user: "1002:1003" |
157 | | - cap_drop: |
158 | | - - ALL |
159 | | - volume: |
160 | | - - metal3-ironic-conf:/conf |
161 | | - - metal3-ironic-data:/data |
162 | | - - metal3-ironic-shared:/shared |
163 | | - secrets: "{{ ironic_secrets }}" |
164 | | - env: "{{ ironic_env }}" |
165 | | - command: |
166 | | - - /bin/runironic |
167 | | - state: started |
168 | | - |
169 | | -- name: Run httpd container |
170 | | - containers.podman.podman_container: |
171 | | - name: httpd |
172 | | - pod: metal3-ironic |
173 | | - image: "{{ metal3_ironic_image }}" |
174 | | - authfile: "{{ pullSecretPath }}" |
175 | | - restart_policy: always |
176 | | - user: "1002:1003" |
177 | | - cap_drop: |
178 | | - - ALL |
179 | | - volume: |
180 | | - - metal3-ironic-shared:/shared |
181 | | - env: |
182 | | - IRONIC_LISTEN_PORT: "6385" |
183 | | - HTTP_PORT: "6180" |
184 | | - LISTEN_ALL_INTERFACES: "true" |
185 | | - USE_IRONIC_INSPECTOR: "false" |
186 | | - PROVISIONING_IP: "{{ lzBmcIP }}" |
187 | | - command: |
188 | | - - /bin/runhttpd |
189 | | - state: started |
190 | | - |
191 | | -- name: Wait for metal3-ironic pod and containers to be running |
192 | | - containers.podman.podman_pod_info: |
193 | | - name: metal3-ironic |
194 | | - register: r_pod_ready |
195 | | - retries: 60 |
196 | | - delay: 5 |
197 | | - until: |
198 | | - - r_pod_ready.pods | length > 0 |
199 | | - - r_pod_ready.pods[0].Containers | selectattr('Name', 'equalto', 'ironic') | selectattr('State', 'equalto', 'running') | list | length == 1 |
200 | | - - r_pod_ready.pods[0].Containers | selectattr('Name', 'equalto', 'httpd') | selectattr('State', 'equalto', 'running') | list | length == 1 |
201 | | - changed_when: false |
202 | | - # Note: Checks that both ironic and httpd containers are running (infra container state is ignored) |
| 83 | +- name: Deploy Ironic via quadlet (persistent) |
| 84 | + when: metal3_persistent | default(false) | bool |
| 85 | + ansible.builtin.include_tasks: deploy_ironic_quadlet_units.yaml |
203 | 86 |
|
204 | 87 | - name: Verify HTTP server accessibility |
205 | 88 | ansible.builtin.uri: |
|
0 commit comments