-
Notifications
You must be signed in to change notification settings - Fork 23
Add secret store unseal playbook for action runners #1969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stackhpc/2025.1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| --- | ||
| - name: Unseal secret store on the ci-runners | ||
| any_errors_fatal: true | ||
| gather_facts: true | ||
| hosts: github-runners:gitlab-runners | ||
| vars: | ||
| vault_api_addr: http://127.0.0.1:8200 | ||
| tasks: | ||
| - name: Set a fact about the virtualenv on the remote system | ||
| ansible.builtin.set_fact: | ||
| virtualenv: "{{ ansible_python_interpreter | dirname | dirname }}" | ||
| when: | ||
| - ansible_python_interpreter is defined | ||
| - not ansible_python_interpreter.startswith('/bin/') | ||
| - not ansible_python_interpreter.startswith('/usr/bin/') | ||
|
|
||
| - name: Ensure Python hvac module is installed | ||
| ansible.builtin.pip: | ||
| name: hvac | ||
| state: latest | ||
| extra_args: "{% if pip_upper_constraints_file %}-c {{ pip_upper_constraints_file }}{% endif %}" | ||
| virtualenv: "{{ virtualenv is defined | ternary(virtualenv, omit) }}" | ||
| become: "{{ virtualenv is not defined }}" | ||
|
Comment on lines
+9
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These first two tasks, for setting up the virtualenv fact and installing the |
||
|
|
||
| - name: Include secret store keys | ||
| ansible.builtin.include_vars: | ||
| file: "{{ kayobe_env_config_path }}/{{ stackhpc_ca_secret_store }}/kayobe-automation-keys.json" | ||
| name: secret_store_keys | ||
|
|
||
| - name: Apply unseal role | ||
| ansible.builtin.import_role: | ||
| name: stackhpc.hashicorp.vault_unseal | ||
| vars: | ||
| vault_unseal_keys: "{{ secret_store_keys.keys_base64 }}" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better idempotency and predictability, it's recommended to use
state: presentinstead ofstate: latest. Usinglatestcan cause thehvacpackage to be reinstalled on every playbook run if a newer version is available, which might not be the desired behavior and can lead to unexpected changes.presentwill ensure the package is installed and will not attempt to upgrade it if it's already present, while still respecting the version specified inpip_upper_constraints_fileif provided.