Skip to content

Commit 609b6be

Browse files
committed
feat: add playbooks for deploying runners and OpenBao automation
1 parent 156c714 commit 609b6be

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
- name: Deploy GitLab runners
3+
hosts: gitlab-runners
4+
become: true
5+
pre_tasks:
6+
- name: Ensure /opt/.docker folder exists
7+
ansible.builtin.file:
8+
path: /opt/.docker
9+
state: directory
10+
11+
- name: Ensure docker/config.json exists for runner
12+
ansible.builtin.file:
13+
content: |
14+
{
15+
"auths": {
16+
"{{ pulp_url | regex_replace('^https?://|^http?://', '') }}": {
17+
"auth": "{{ (pulp_username + ':' + pulp_password) | b64encode }}"
18+
}
19+
}
20+
}
21+
dest: /opt/.docker/config.json
22+
mode: "0600"
23+
24+
roles:
25+
- name: riemers.gitlab-runner
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
- name: Deploy OpenBao on the runners
3+
any_errors_fatal: true
4+
gather_facts: true
5+
hosts: github-runners,gitlab-runners
6+
tasks:
7+
- name: Set a fact about the virtualenv on the remote system
8+
set_fact:
9+
virtualenv: "{{ ansible_python_interpreter | dirname | dirname }}"
10+
when:
11+
- ansible_python_interpreter is defined
12+
- not ansible_python_interpreter.startswith('/bin/')
13+
- not ansible_python_interpreter.startswith('/usr/bin/')
14+
15+
- name: Ensure Python hvac module is installed
16+
pip:
17+
name: hvac
18+
state: latest
19+
extra_args: "{% if pip_upper_constraints_file %}-c {{ pip_upper_constraints_file }}{% endif %}"
20+
virtualenv: "{{ virtualenv is defined | ternary(virtualenv, omit) }}"
21+
become: "{{ virtualenv is not defined }}"
22+
23+
- name: Ensure /opt/kayobe/vault exists
24+
file:
25+
path: /opt/kayobe/vault
26+
state: directory
27+
become: true
28+
29+
- import_role:
30+
name: stackhpc.hashicorp.openbao
31+
vars:
32+
openbao_config_dir: "/opt/kayobe/vault"
33+
openbao_cluster_name: "kayobe-automation"
34+
copy_self_signed_ca: false
35+
openbao_write_keys_file: true
36+
openbao_write_keys_file_path: "{{ kayobe_env_config_path }}/vault/kayobe-automation-keys.json"
37+
38+
- name: Include OpenBao keys
39+
include_vars:
40+
file: "{{ kayobe_env_config_path }}/vault/kayobe-automation-keys.json"
41+
name: openbao_keys
42+
tags: always
43+
44+
- import_role:
45+
name: stackhpc.hashicorp.vault_unseal
46+
vars:
47+
vault_api_addr: "{{ openbao_api_addr }}"
48+
vault_unseal_token: "{{ openbao_keys.root_token }}"
49+
vault_unseal_keys: "{{ openbao_keys.keys_base64 }}"
50+
vault_unseal_verify: false
51+
environment:
52+
https_proxy: ''
53+
54+
- name: Create secret store
55+
hashivault_secret_engine:
56+
name: kayobe-automation
57+
backend: kv
58+
url: "{{ openbao_api_addr }}"
59+
token: "{{ openbao_keys.root_token }}"
60+
61+
- name: Ensure secret store is present
62+
community.hashi_vault.vault_write:
63+
url: "{{ openbao_api_addr }}"
64+
token: "{{ openbao_keys.root_token }}"
65+
path: kayobe-automation/{{ kayobe_environment }}
66+
data:
67+
kayobe_vault_password: "{{ kolla_ansible_vault_password }}"
68+
kayobe_automation_ssh_private_key: "{{ lookup('ansible.builtin.file', '{{ ssh_private_key_path }}') }}"
69+
kayobe_public_openrc: "{{ lookup('ansible.builtin.file', '{{ kolla_config_path }}/public-openrc.sh') }}"
70+
tags: add_secrets
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
- name: Write Kayobe Automation Pipeline for GitLab
3+
hosts: gitlab-writer
4+
vars:
5+
gitlab_output_directory: "{{ kayobe_config_path }}/../../"
6+
roles:
7+
- stackhpc.kayobe_workflows.gitlab

0 commit comments

Comments
 (0)