packer: move worker-config creation to ansible

I think it untangles the initialization a bit and allows me to do some more
refactorings.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2022-03-10 21:32:19 +01:00 committed by Ondřej Budai
parent 2a4d4c4d49
commit 2e7815bf53
5 changed files with 16 additions and 3 deletions

View file

@ -0,0 +1 @@
base_path = "/api/image-builder-worker/v1"

View file

@ -9,6 +9,5 @@ echo "Writing offline token."
--endpoint-url "${SECRETS_MANAGER_ENDPOINT_URL}" \
--secret-id "${OFFLINE_TOKEN_ARN}" | jq -r ".SecretString" > /tmp/offline-token.json
mkdir /etc/osbuild-worker
jq -r ".offline_token" /tmp/offline-token.json > /etc/osbuild-worker/offline-token
rm -f /tmp/offline-token.json

View file

@ -4,8 +4,7 @@ source /tmp/cloud_init_vars
echo "Setting up worker services."
sudo tee /etc/osbuild-worker/osbuild-worker.toml > /dev/null << EOF
base_path = "/api/image-builder-worker/v1"
sudo tee -a /etc/osbuild-worker/osbuild-worker.toml > /dev/null << EOF
[authentication]
oauth_url = "https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token"
offline_token = "/etc/osbuild-worker/offline-token"

View file

@ -9,5 +9,8 @@
# Configure worker initialization service.
- include_tasks: worker-initialization-service.yml
# Configure the worker.
- include_tasks: worker-config.yml
- name: Ensure SELinux contexts are updated
command: restorecon -Rv /etc

View file

@ -0,0 +1,11 @@
---
- name: Create osbuild-worker config directory
file:
path: /etc/osbuild-worker/
state: directory
- name: Copy worker config stub
copy:
src: "{{ playbook_dir }}/roles/common/files/osbuild-worker.toml"
dest: /etc/osbuild-worker/osbuild-worker.toml