Skip to content

Conversation

@seunghun1ee
Copy link
Member

When CI action runners are rebooted, their secret store needs to be unsealed.
Added unsealing playbook for them.

When CI action runners are rebooted, their secret store needs to be
unsealed.
Added unsealing playbook for them.
@seunghun1ee seunghun1ee self-assigned this Nov 5, 2025
@seunghun1ee seunghun1ee requested a review from a team as a code owner November 5, 2025 11:57
@seunghun1ee seunghun1ee added Epoxy ansible Ansible playbooks labels Nov 5, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Ansible playbook for unsealing the secret store on CI action runners, which is a necessary step after they are rebooted. The playbook is clear and follows existing patterns within the project. My review includes a couple of suggestions to improve maintainability and idempotency. One suggestion is to change the pip package state from latest to present to ensure predictable behavior. The other is a recommendation to refactor common tasks into a shared role to avoid code duplication with other similar playbooks.

Comment on lines +9 to +23
- 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 }}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These first two tasks, for setting up the virtualenv fact and installing the hvac package, are also present in secret-store-unseal-seed.yml and secret-store-unseal-overcloud.yml. To improve maintainability and reduce code duplication, consider extracting these common tasks into a new Ansible role (e.g., vault-client-prereqs). This new role could then be included in all three playbooks, making the codebase easier to manage in the long run.

- name: Ensure Python hvac module is installed
ansible.builtin.pip:
name: hvac
state: latest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better idempotency and predictability, it's recommended to use state: present instead of state: latest. Using latest can cause the hvac package 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. present will ensure the package is installed and will not attempt to upgrade it if it's already present, while still respecting the version specified in pip_upper_constraints_file if provided.

        state: present

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ansible Ansible playbooks Epoxy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants