Skip to content

Commit e11d7be

Browse files
committed
mgmt-23250: Expose AAP configuration from the LZ
Signed-off-by: Manuel Lorenzo <mlorenzofr@redhat.com>
1 parent 997e4ce commit e11d7be

5 files changed

Lines changed: 88 additions & 6 deletions

File tree

defaults/vmaas_operators.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@ aap_bootstrap_job:
1313
tag: latest
1414

1515
aap_license_file: "{{ workingDir }}/config/aap-license.zip"
16+
aap_archive_tmp_dir: "/tmp/aap-config-source"
17+
aap_config_repo: "https://github.com/osac-project/osac-aap-config.git"
18+
aap_config_version: "main"
19+
aap_archive_image: "registry.redhat.io/ubi9/nginx-126@sha256:d68c1643e3a1184c38f87391fd1054724d8ed2e14324c090091d6c724dc1c335"
20+
aap_archive_port: 4480
21+
aap_archive_authfile: "{{ workingDir }}/config/pull-secret.json"
22+
aap_archive_dest: "{{ workingDir }}/files/aap-config-archive.tar.gz"
23+
aap_archive_refresh: false # Set to true to force a refresh of the AAP configuration archive

playbooks/06-day2.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@
8686
ansible.builtin.include_tasks:
8787
file: tasks/vmaas_validation.yaml
8888
apply:
89-
tags: vmaas
89+
tags:
90+
- vmaas
91+
- aap_archive_service
9092
environment:
9193
KUBECONFIG: "{{ workingDir }}/ocp-cluster/auth/kubeconfig"
92-
tags: vmaas
94+
tags:
95+
- vmaas
96+
- aap_archive_service
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
- name: "Check if the repository tarball exists"
3+
ansible.builtin.stat:
4+
path: "{{ aap_archive_dest }}"
5+
register: __aap_archive_tarball_exists
6+
failed_when: false
7+
changed_when: false
8+
9+
# If the repository tarball exists, you can force a refresh by setting aap_archive_refresh to true
10+
- name: "Package AAP configuration repository and serve via HTTP"
11+
block:
12+
- name: "Create temporary directory"
13+
ansible.builtin.file:
14+
path: "{{ aap_archive_tmp_dir }}"
15+
state: directory
16+
mode: "0750"
17+
18+
- name: "Clone the configuration repository"
19+
ansible.builtin.git:
20+
repo: "{{ aap_config_repo }}"
21+
dest: "{{ aap_archive_tmp_dir }}"
22+
version: "{{ aap_config_version }}"
23+
24+
- name: "Create tarball of the repository"
25+
ansible.builtin.archive:
26+
path: "{{ aap_archive_tmp_dir }}"
27+
dest: "{{ aap_archive_dest }}"
28+
format: gz
29+
ignore_errors: "{{ ansible_check_mode }}"
30+
31+
- name: "Set container recreate flag"
32+
ansible.builtin.set_fact:
33+
__aap_archive_container_recreate: true
34+
always:
35+
- name: "Remove temporary directory"
36+
ansible.builtin.file:
37+
path: "{{ aap_archive_tmp_dir }}"
38+
state: absent
39+
no_log: true
40+
when: >
41+
__aap_archive_tarball_exists.stat.exists is false or
42+
__aap_archive_tarball_exists.stat.exists is not defined or
43+
aap_archive_refresh | default(false) | bool
44+
45+
- name: "Run container to publish the AAP configuration"
46+
containers.podman.podman_container:
47+
name: "aap-archive-srv"
48+
image: "{{ aap_archive_image }}"
49+
authfile: "{{ aap_archive_authfile }}"
50+
state: started
51+
restart_policy: always
52+
recreate: "{{ __aap_archive_container_recreate | default(false) | bool }}"
53+
user: "1001"
54+
command: "/usr/libexec/s2i/run"
55+
security_opt:
56+
- no-new-privileges
57+
cap_drop:
58+
- ALL
59+
volumes:
60+
- "{{ aap_archive_dest }}:/opt/app-root/src/aap-config-archive.tar.gz:Z"
61+
publish:
62+
- "{{ aap_archive_port }}:8080"

playbooks/tasks/vmaas_validation.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,17 @@
3333
not __aap_license_stat.stat.exists | bool
3434
3535
- name: "Deploy VMaaS"
36-
ansible.builtin.include_tasks:
37-
file: vmaas.yaml
38-
apply:
39-
tags: vmaas
36+
block:
37+
- name: "Deploy AAP configuration archive service in the LZ"
38+
ansible.builtin.include_tasks:
39+
file: aap_archive_service.yaml
40+
apply:
41+
tags: aap_archive_service
42+
- name: "Deploy VMaaS"
43+
ansible.builtin.include_tasks:
44+
file: vmaas.yaml
45+
apply:
46+
tags: vmaas
4047
when:
4148
- vmaas_clusters | length > 0
4249
- __aap_license_stat.stat.exists is defined

playbooks/templates/aap-config.yaml.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ metadata:
55
namespace: {{ aap_ns | default('ansible-aap') }}
66
type: Opaque
77
stringData:
8+
AAP_PROJECT_ARCHIVE_URI: "http://{{ lzBmcIP }}:{{ aap_archive_port }}/aap-config-archive.tar.gz"
89
REMOTE_CLUSTER_KUBECONFIG_SECRET_NAME: "{{ aap_kubeconfig_secret_name | default('vmaas-cluster-kubeconfig') }}"

0 commit comments

Comments
 (0)