|
158 | 158 | type: Opaque |
159 | 159 | stringData: "{{ k8s_environment_variables | from_yaml }}" |
160 | 160 |
|
161 | | -# Run migrations if wanted |
162 | | -- when: k8s_migrations_enabled |
163 | | - vars: |
164 | | - job_name: "migrate" |
165 | | - batch_command: "{{ k8s_migration_command }}" |
166 | | - block: |
167 | | - - name: remove any old migration jobs |
168 | | - k8s: |
169 | | - api_key: "{{ k8s_auth_api_key }}" |
170 | | - host: "{{ k8s_auth_host }}" |
171 | | - ca_cert: "{{ k8s_auth_ssl_ca_cert }}" |
172 | | - definition: "{{ lookup('template', 'batchjob.yaml.j2') }}" |
173 | | - state: absent |
174 | | - wait: yes |
175 | | - validate: |
176 | | - fail_on_error: yes |
177 | | - strict: yes |
178 | | - - name: run migrations |
179 | | - k8s: |
180 | | - api_key: "{{ k8s_auth_api_key }}" |
181 | | - host: "{{ k8s_auth_host }}" |
182 | | - ca_cert: "{{ k8s_auth_ssl_ca_cert }}" |
183 | | - definition: "{{ lookup('template', 'batchjob.yaml.j2') }}" |
184 | | - state: present |
185 | | - wait: yes |
186 | | - wait_condition: |
187 | | - type: Complete |
188 | | - status: "True" |
189 | | - validate: |
190 | | - fail_on_error: yes |
191 | | - strict: yes |
192 | | - |
193 | | -- when: k8s_collectstatic_enabled |
194 | | - vars: |
195 | | - job_name: "collectstatic" |
196 | | - batch_command: "{{ k8s_collectstatic_command }}" |
197 | | - block: |
198 | | - - name: remove any old collectstatic jobs |
199 | | - k8s: |
200 | | - api_key: "{{ k8s_auth_api_key }}" |
201 | | - host: "{{ k8s_auth_host }}" |
202 | | - ca_cert: "{{ k8s_auth_ssl_ca_cert }}" |
203 | | - definition: "{{ lookup('template', 'batchjob.yaml.j2') }}" |
204 | | - state: absent |
205 | | - wait: yes |
206 | | - validate: |
207 | | - fail_on_error: yes |
208 | | - strict: yes |
209 | | - - name: run collectstatic |
210 | | - k8s: |
211 | | - api_key: "{{ k8s_auth_api_key }}" |
212 | | - host: "{{ k8s_auth_host }}" |
213 | | - ca_cert: "{{ k8s_auth_ssl_ca_cert }}" |
214 | | - definition: "{{ lookup('template', 'batchjob.yaml.j2') }}" |
215 | | - state: present |
216 | | - wait: yes |
217 | | - wait_condition: |
218 | | - type: Complete |
219 | | - status: "True" |
220 | | - wait_timeout: "{{ k8s_collectstatic_timeout }}" |
221 | | - validate: |
222 | | - fail_on_error: yes |
223 | | - strict: yes |
| 161 | +# Run each pre-deploy batch job in turn, if wanted |
| 162 | +- loop: "{{ k8s_predeploy_batchjobs }}" |
| 163 | + loop_control: |
| 164 | + loop_var: batchjob |
| 165 | + include_tasks: batchjob_tasks.yml |
224 | 166 |
|
225 | 167 | - name: Create/update templates in Kubernetes |
226 | 168 | k8s: |
|
272 | 214 | command: kubectl --namespace "{{ k8s_namespace }}" rollout restart statefulset/celery-beat |
273 | 215 | no_log: True |
274 | 216 | when: k8s_worker_beat_enabled |
| 217 | + |
| 218 | +# Run each post-deploy batch job in turn, if wanted |
| 219 | +- loop: "{{ k8s_postdeploy_batchjobs }}" |
| 220 | + loop_control: |
| 221 | + loop_var: batchjob |
| 222 | + include_tasks: batchjob_tasks.yml |
0 commit comments