-
Notifications
You must be signed in to change notification settings - Fork 23
Add GitLab based Kayobe-Automation #1471
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2a74bb5
feat: add required collections and roles for GitLab CI
jackhodgkiss 156c714
feat: add group definitions for gitlab runners and writers
jackhodgkiss 609b6be
feat: add playbooks for deploying runners and OpenBao automation
jackhodgkiss d0de34b
feat: update `ci-cd` documentation
jackhodgkiss beba077
fix: linting issues
jackhodgkiss beaedd3
fix: resolve issues against PR
jackhodgkiss ffaf5d7
Merge branch 'stackhpc/2024.1' into add-gitlab-kayobe-automation
jackhodgkiss 8197472
feat: apply suggested changes
jackhodgkiss f3b4fde
docs: update CI/CD documentation
jackhodgkiss 4d76e84
feat: pin collections to branch names
jackhodgkiss 0270f12
feat: update docs on `GitLab Pipelines`
jackhodgkiss 22d9841
feat: update `stackhpc.kayobe_workflows` collection
jackhodgkiss 2e27317
Merge branch 'stackhpc/2024.1' into add-gitlab-kayobe-automation
jackhodgkiss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
- name: Deploy GitLab runners | ||
hosts: gitlab-runners | ||
become: true | ||
pre_tasks: | ||
- name: Ensure /opt/.docker folder exists | ||
ansible.builtin.file: | ||
path: /opt/.docker | ||
state: directory | ||
|
||
- name: Ensure docker/config.json exists for runner | ||
ansible.builtin.copy: | ||
content: | | ||
{ | ||
"auths": { | ||
"{{ pulp_url | regex_replace('^https?://|^http?://', '') }}": { | ||
"auth": "{{ (pulp_username + ':' + pulp_password) | b64encode }}" | ||
} | ||
} | ||
} | ||
dest: /opt/.docker/config.json | ||
mode: "0600" | ||
roles: | ||
- role: riemers.gitlab-runner |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
- name: Deploy OpenBao on the runners | ||
any_errors_fatal: true | ||
gather_facts: true | ||
hosts: github-runners,gitlab-runners | ||
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 }}" | ||
|
||
- name: Ensure /opt/kayobe/vault exists | ||
ansible.builtin.file: | ||
path: /opt/kayobe/vault | ||
state: directory | ||
become: true | ||
|
||
jackhodgkiss marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Ensure vault directory exists in environment | ||
ansible.builtin.file: | ||
path: "{{ kayobe_env_config_path }}/vault" | ||
state: directory | ||
become: true | ||
|
||
- name: Import OpenBao role | ||
ansible.builtin.import_role: | ||
name: stackhpc.hashicorp.openbao | ||
vars: | ||
openbao_config_dir: "/opt/kayobe/vault" | ||
openbao_cluster_name: "kayobe-automation" | ||
copy_self_signed_ca: false | ||
openbao_write_keys_file: true | ||
openbao_write_keys_file_path: "{{ kayobe_env_config_path }}/vault/kayobe-automation-keys.json" | ||
|
||
- name: Include OpenBao keys | ||
ansible.builtin.include_vars: | ||
file: "{{ kayobe_env_config_path }}/vault/kayobe-automation-keys.json" | ||
name: openbao_keys | ||
tags: always | ||
|
||
- name: Import Vault unseal role | ||
ansible.builtin.import_role: | ||
name: stackhpc.hashicorp.vault_unseal | ||
vars: | ||
vault_api_addr: "{{ openbao_api_addr }}" | ||
vault_unseal_token: "{{ openbao_keys.root_token }}" | ||
vault_unseal_keys: "{{ openbao_keys.keys_base64 }}" | ||
vault_unseal_verify: false | ||
environment: | ||
https_proxy: '' | ||
|
||
- name: Create secret store | ||
ansible.legacy.hashivault_secret_engine: | ||
name: kayobe-automation | ||
backend: kv | ||
url: "{{ openbao_api_addr }}" | ||
token: "{{ openbao_keys.root_token }}" | ||
|
||
- name: Ensure secret store is present | ||
community.hashi_vault.vault_write: | ||
url: "{{ openbao_api_addr }}" | ||
token: "{{ openbao_keys.root_token }}" | ||
path: kayobe-automation/{{ kayobe_environment }} | ||
data: | ||
kayobe_vault_password: "{{ kolla_ansible_vault_password }}" | ||
kayobe_automation_ssh_private_key: "{{ lookup('ansible.builtin.file', '{{ ssh_private_key_path }}') }}" | ||
kayobe_public_openrc: "{{ lookup('ansible.builtin.file', '{{ kolla_config_path }}/public-openrc.sh') }}" | ||
tags: add_secrets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Write Kayobe Automation Pipeline for GitLab | ||
hosts: gitlab-writer | ||
vars: | ||
gitlab_output_directory: "{{ kayobe_config_path }}/../../" | ||
roles: | ||
- stackhpc.kayobe_workflows.gitlab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
# Configuration of GitLab runners using riemers.gitlab-runner should go here. | ||
# See documentation for more information | ||
# https://github.com/riemers/ansible-gitlab-runner | ||
# https://stackhpc-kayobe-config.readthedocs.io/en/stackhpc-2024.1/configuration/ci-cd.html | ||
|
||
############################################################################### | ||
# Dummy variable to allow Ansible to accept this file. | ||
workaround_ansible_issue_8743: yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
# Configuration of GitLab pipelines generated with stackhpc.kayobe_workflows.gitlab should go here. | ||
# See documentation for more information | ||
# https://github.com/stackhpc/ansible-collection-kayobe-workflows/blob/main/roles/gitlab/README.md | ||
|
||
gitlab_output_directory: $KAYOBE_CONFIG_PATH/../../.gitlab/ | ||
|
||
gitlab_registry: "{{ pulp_url | regex_replace('^https?://|^http?://', '') }}" | ||
|
||
gitlab_openstack_release: "{{ openstack_release }}" | ||
|
||
############################################################################### | ||
# Dummy variable to allow Ansible to accept this file. | ||
workaround_ansible_issue_8743: yes |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.