Skip to content

Commit d69a795

Browse files
committed
Implement enable audit logging suggestions
- explicitly specify glance backend config in customServiceConfig, because otherwise it'll get overwritten by the audit logging config - use include_tasks instead of import tasks - use block/always to ensure temporary dir gets always deleted Closes: OSPRH-30106
1 parent 45cc596 commit d69a795

3 files changed

Lines changed: 45 additions & 31 deletions

File tree

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
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
68

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
1113
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"
1618

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"
2123

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 }}
2527
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

ci/enable-audit-logging/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- name: Create service audit config secrets
2-
ansible.builtin.import_tasks: create-secrets.yml
2+
ansible.builtin.include_tasks: create-secrets.yml
33

44
# Barbican: disabled - the barbican-operator does not currently support
55
# providing a custom api-paste.ini through defaultConfigOverwrite.
@@ -17,5 +17,5 @@
1717
when: not enable_audit_logging_local_apply
1818

1919
- name: Apply kustomization against live OSCP
20-
ansible.builtin.import_tasks: apply-local.yml
20+
ansible.builtin.include_tasks: apply-local.yml
2121
when: enable_audit_logging_local_apply

ci/enable-audit-logging/templates/90-kustomize-controlplane-audit-logging.yaml.j2

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,22 @@ patches:
2828
secretName: {{ enable_audit_logging_cinder_secret }}
2929
glance:
3030
template:
31-
glanceAPIs:
32-
default:
33-
customServiceConfig: |
34-
[paste_deploy]
35-
config_file = /etc/glance/custom/glance-api-paste.ini
31+
{% raw %}
32+
customServiceConfig: |
33+
[DEFAULT]
34+
enabled_backends = default_backend:swift
35+
[glance_store]
36+
default_backend = default_backend
37+
[default_backend]
38+
swift_store_create_container_on_put = True
39+
swift_store_auth_version = 3
40+
swift_store_auth_address = {{ .KeystoneInternalURL }}
41+
swift_store_endpoint_type = internalURL
42+
swift_store_user = service:glance
43+
swift_store_key = {{ .ServicePassword }}
44+
[paste_deploy]
45+
config_file = /etc/glance/custom/glance-api-paste.ini
46+
{% endraw %}
3647
extraMounts:
3748
- name: audit-config-files
3849
region: r1

0 commit comments

Comments
 (0)