-
Notifications
You must be signed in to change notification settings - Fork 23
Pulp tls update #1743
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
Open
jackhodgkiss
wants to merge
8
commits into
update-vault-docs-dec-2024
Choose a base branch
from
pulp-tls-update
base: update-vault-docs-dec-2024
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Pulp tls update #1743
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3ebdcbc
Merge branch 'stackhpc/2024.1' into update-vault-docs-dec-2024
jackhodgkiss 27410af
feat: add playbook for generating `pulp` cert with `OpenBao`
jackhodgkiss 464cca2
feat: refactor `copy-ca-to-hosts` playbook
jackhodgkiss a33941c
Merge branch 'update-vault-docs-dec-2024' into pulp-tls-update
jackhodgkiss e42ad31
fix: add missing `EOL`
jackhodgkiss 3d1c0a3
feat: do not copy `OS-TLS-INT`
jackhodgkiss 9c234ad
feat: set docker `CA` if `Pulp` TLS is enabled
jackhodgkiss 854d6ff
feat: support using `copy-ca-to-hosts` as hook
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,47 @@ | ||
--- | ||
- name: Copy CA certificate and update trust | ||
- name: Install certificate authorities and update trust | ||
hosts: overcloud:seed:seed-hypervisor | ||
become: true | ||
# Avoid using facts because this may be used as a pre overcloud host | ||
# configure hook, and we don't want to populate the fact cache (if one is in | ||
# use) with the bootstrap user's context. | ||
gather_facts: false | ||
tags: | ||
- install-ca | ||
vars: | ||
cert_path: "{{ kayobe_env_config_path }}/vault/OS-TLS-ROOT.pem" | ||
|
||
ansible_user: "{{ bootstrap_user }}" | ||
# We can't assume that a virtualenv exists at this point, so use the system | ||
# python interpreter. | ||
ansible_python_interpreter: /usr/bin/python3 | ||
# Work around no known_hosts entry on first boot. | ||
ansible_ssh_common_args: -o StrictHostKeyChecking=no | ||
# Don't assume facts are present. | ||
os_family: "{{ ansible_facts.os_family | default('Debian' if os_distribution == 'ubuntu' else 'RedHat') }}" | ||
become: true | ||
tasks: | ||
- name: Copy certificate on RedHat family systems (Rocky, RHEL, CentOS) | ||
ansible.builtin.copy: | ||
src: "{{ cert_path }}" | ||
dest: "/etc/pki/ca-trust/source/anchors/OS-TLS-ROOT.pem" | ||
mode: "0644" | ||
when: ansible_facts.os_family == 'RedHat' | ||
- name: Install certificate authorities on RedHat based distributions | ||
when: os_family == 'RedHat' | ||
block: | ||
- name: Copy certificate authorities on RedHat family systems (Rocky, RHEL, CentOS) | ||
ansible.builtin.copy: | ||
src: "{{ kayobe_env_config_path }}/openbao/{{ item }}.pem" | ||
dest: "/etc/pki/ca-trust/source/anchors/{{ item }}.crt" | ||
mode: "0644" | ||
loop: | ||
- "OS-TLS-ROOT" | ||
|
||
- name: Update CA trust on RedHat family systems | ||
ansible.builtin.command: "update-ca-trust" | ||
when: ansible_facts.os_family == 'RedHat' | ||
- name: Update CA trust on RedHat family systems | ||
ansible.builtin.command: "update-ca-trust" | ||
|
||
- name: Copy certificate on Debian family systems (Ubuntu, Debian) | ||
ansible.builtin.copy: | ||
src: "{{ cert_path }}" | ||
dest: "/usr/local/share/ca-certificates/OS-TLS-ROOT.crt" | ||
mode: "0644" | ||
when: ansible_facts.os_family == 'Debian' | ||
- name: Install certificate authorities on Debian based distributions | ||
when: os_family == 'Debian' | ||
block: | ||
- name: Copy certificate authorities on Debian family systems (Ubuntu, Debian) | ||
ansible.builtin.copy: | ||
src: "{{ kayobe_env_config_path }}/openbao/{{ item }}.pem" | ||
dest: "/usr/local/share/ca-certificates/{{ item }}.crt" | ||
mode: "0644" | ||
loop: | ||
- "OS-TLS-ROOT" | ||
|
||
- name: Update CA trust on Debian family systems | ||
ansible.builtin.command: "update-ca-certificates" | ||
when: ansible_facts.os_family == 'Debian' | ||
- name: Update CA trust on Debian family systems | ||
ansible.builtin.command: "update-ca-certificates" |
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,49 @@ | ||
--- | ||
- name: Generate certificates | ||
hosts: seed | ||
run_once: true | ||
vars: | ||
openbao_api_addr: http://127.0.0.1:8200 | ||
openbao_intermediate_ca_name: OS-TLS-INT | ||
tasks: | ||
- name: Include OpenBao keys | ||
ansible.builtin.include_vars: | ||
file: "{{ kayobe_env_config_path }}/openbao/seed-openbao-keys.json" | ||
name: openbao_keys | ||
|
||
- name: Issue a certificate Pulp | ||
hashivault_pki_cert_issue: # noqa: fqcn | ||
url: "{{ openbao_api_addr }}" | ||
ca_cert: "{{ '/etc/pki/tls/certs/ca-bundle.crt' if ansible_facts.os_family == 'RedHat' else '/usr/local/share/ca-certificates/OS-TLS-ROOT.crt' }}" | ||
token: "{{ openbao_keys.root_token }}" | ||
mount_point: "{{ openbao_intermediate_ca_name }}" | ||
role: "{{ overcloud_openbao_pki_default_role_name }}" | ||
common_name: "{{ inventory_hostname }}" | ||
extra_params: | ||
ip_sans: "{{ admin_oc_net_name | net_ip(inventory_hostname=groups['seed'][0]) }}" | ||
register: pulp_certificate | ||
|
||
- name: Ensure pulp certificates directory exists | ||
ansible.builtin.file: | ||
path: "{{ kayobe_env_config_path }}/pulp/certificates" | ||
state: directory | ||
delegate_to: localhost | ||
|
||
- name: Write certificate to file | ||
no_log: true | ||
ansible.builtin.copy: | ||
dest: "{{ kayobe_env_config_path }}/pulp/certificates/pulp.crt" | ||
content: | | ||
{{ pulp_certificate.data.certificate }} | ||
{{ pulp_certificate.data.issuing_ca }} | ||
mode: "0600" | ||
delegate_to: localhost | ||
|
||
- name: Write key to file | ||
no_log: true | ||
ansible.builtin.copy: | ||
dest: "{{ kayobe_env_config_path }}/pulp/certificates/pulp.key" | ||
content: | | ||
{{ pulp_certificate.data.private_key }} | ||
mode: "0600" | ||
delegate_to: localhost |
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
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.
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.
Lets not default to Bao in this instance. We still have many more people using vault on Caracal