Skip to content

Commit 1e33d76

Browse files
committed
Add secret store unseal playbook for action runners
When CI action runners are rebooted, their secret store needs to be unsealed. Added unsealing playbook for them.
1 parent 823545d commit 1e33d76

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
- name: Unseal secret store on the ci-runners
3+
any_errors_fatal: true
4+
gather_facts: true
5+
hosts: github-runners:gitlab-runners
6+
vars:
7+
vault_api_addr: http://127.0.0.1:8200
8+
tasks:
9+
- name: Set a fact about the virtualenv on the remote system
10+
ansible.builtin.set_fact:
11+
virtualenv: "{{ ansible_python_interpreter | dirname | dirname }}"
12+
when:
13+
- ansible_python_interpreter is defined
14+
- not ansible_python_interpreter.startswith('/bin/')
15+
- not ansible_python_interpreter.startswith('/usr/bin/')
16+
17+
- name: Ensure Python hvac module is installed
18+
ansible.builtin.pip:
19+
name: hvac
20+
state: latest
21+
extra_args: "{% if pip_upper_constraints_file %}-c {{ pip_upper_constraints_file }}{% endif %}"
22+
virtualenv: "{{ virtualenv is defined | ternary(virtualenv, omit) }}"
23+
become: "{{ virtualenv is not defined }}"
24+
25+
- name: Include secret store keys
26+
ansible.builtin.include_vars:
27+
file: "{{ kayobe_env_config_path }}/{{ stackhpc_ca_secret_store }}/kayobe-automation-keys.json"
28+
name: secret_store_keys
29+
30+
- name: Apply unseal role
31+
ansible.builtin.import_role:
32+
name: stackhpc.hashicorp.vault_unseal
33+
vars:
34+
vault_unseal_keys: "{{ secret_store_keys.keys_base64 }}"

0 commit comments

Comments
 (0)