|
1 | | -- name: Create temp directory for local kustomization |
2 | | - ansible.builtin.tempfile: |
3 | | - state: directory |
4 | | - prefix: audit-logging- |
5 | | - register: audit_kustomize_dir |
| 1 | +- name: Enable audit logs locally post-deploy |
| 2 | + block: |
| 3 | + - name: Create temp directory for local kustomization |
| 4 | + ansible.builtin.tempfile: |
| 5 | + state: directory |
| 6 | + prefix: audit-logging- |
| 7 | + register: audit_kustomize_dir |
6 | 8 |
|
7 | | -- name: Fetch current OSCP CR |
8 | | - ansible.builtin.shell: > |
9 | | - oc get openstackcontrolplane -o yaml |
10 | | - > {{ audit_kustomize_dir.path }}/oscp.yaml |
| 9 | + - name: Fetch current OSCP CR |
| 10 | + ansible.builtin.shell: > |
| 11 | + oc get openstackcontrolplane -o yaml |
| 12 | + > {{ audit_kustomize_dir.path }}/oscp.yaml |
11 | 13 |
|
12 | | -- name: Render kustomization to temp directory |
13 | | - ansible.builtin.template: |
14 | | - src: 90-kustomize-controlplane-audit-logging.yaml.j2 |
15 | | - dest: "{{ audit_kustomize_dir.path }}/kustomization.yaml" |
| 14 | + - name: Render kustomization to temp directory |
| 15 | + ansible.builtin.template: |
| 16 | + src: 90-kustomize-controlplane-audit-logging.yaml.j2 |
| 17 | + dest: "{{ audit_kustomize_dir.path }}/kustomization.yaml" |
16 | 18 |
|
17 | | -- name: Add OSCP resource to local kustomization |
18 | | - ansible.builtin.lineinfile: |
19 | | - path: "{{ audit_kustomize_dir.path }}/kustomization.yaml" |
20 | | - line: "resources:\n- oscp.yaml" |
| 19 | + - name: Add OSCP resource to local kustomization |
| 20 | + ansible.builtin.lineinfile: |
| 21 | + path: "{{ audit_kustomize_dir.path }}/kustomization.yaml" |
| 22 | + line: "resources:\n- oscp.yaml" |
21 | 23 |
|
22 | | -- name: Apply audit logging kustomization locally |
23 | | - ansible.builtin.command: > |
24 | | - oc apply --server-side --force-conflicts -k {{ audit_kustomize_dir.path }} |
| 24 | + - name: Apply audit logging kustomization locally |
| 25 | + ansible.builtin.command: > |
| 26 | + oc apply --server-side --force-conflicts -k {{ audit_kustomize_dir.path }} |
25 | 27 |
|
26 | | -- name: Clean up temp directory |
27 | | - ansible.builtin.file: |
28 | | - path: "{{ audit_kustomize_dir.path }}" |
29 | | - state: absent |
| 28 | + always: |
| 29 | + - name: Clean up temp directory |
| 30 | + ansible.builtin.file: |
| 31 | + path: "{{ audit_kustomize_dir.path }}" |
| 32 | + state: absent |
0 commit comments