Skip to content

Commit 6904bd2

Browse files
jackhodgkissAlex-Welsh
authored andcommitted
fix: configure requests to use CA for Pulp
The `Pulp` playbooks used at client sites can fail when `Pulp` is configured to use TLS with certificates generated by our internal `TLS` process in combination with the newer `Pulp` collection and tools. Signed-off-by: Jack Hodgkiss <jack@stackhpc.com>
1 parent 0e107e4 commit 6904bd2

7 files changed

Lines changed: 53 additions & 3 deletions

File tree

etc/kayobe/ansible/pulp/pulp-container-publish.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@
99
# NOTE: use intermediate variable to avoid distributing RPMs.
1010
vars:
1111
pulp_distribution_container: "{{ stackhpc_pulp_distribution_container }}"
12+
environment: >-
13+
{{
14+
{
15+
'REQUESTS_CA_BUNDLE': stackhpc_requests_ca_bundle
16+
} if pulp_enable_tls | bool else {}
17+
}}
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
---
22
- name: Sync client Pulp container repositories
33
hosts: localhost
4-
gather_facts: false
4+
gather_facts: true
55
tasks:
66
- name: Sync Pulp container repositories
77
ansible.builtin.import_role:
88
name: stackhpc.pulp.pulp_repository
99
# NOTE: use intermediate variable to avoid syncing RPMs.
1010
vars:
1111
pulp_repository_container_repos: "{{ stackhpc_pulp_repository_container_repos }}"
12+
environment: >-
13+
{{
14+
{
15+
'REQUESTS_CA_BUNDLE': stackhpc_requests_ca_bundle
16+
} if pulp_enable_tls | bool else {}
17+
}}

etc/kayobe/ansible/pulp/pulp-repo-promote-production.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@
99
vars:
1010
pulp_distribution_deb: "{{ stackhpc_pulp_distribution_deb_production | selectattr('required') }}"
1111
pulp_distribution_rpm: "{{ stackhpc_pulp_distribution_rpm_production | selectattr('required') }}"
12+
environment: >-
13+
{{
14+
{
15+
'REQUESTS_CA_BUNDLE': stackhpc_requests_ca_bundle
16+
} if pulp_enable_tls | bool else {}
17+
}}
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Publish Pulp repositories
33
hosts: localhost
4-
gather_facts: false
4+
gather_facts: true
55
tasks:
66
- name: Ensure repository publications exist
77
ansible.builtin.import_role:
@@ -10,10 +10,22 @@
1010
vars:
1111
pulp_publication_deb: "{{ stackhpc_pulp_publication_deb_development | selectattr('required') }}"
1212
pulp_publication_rpm: "{{ stackhpc_pulp_publication_rpm_development | selectattr('required') }}"
13+
environment: >-
14+
{{
15+
{
16+
'REQUESTS_CA_BUNDLE': stackhpc_requests_ca_bundle
17+
} if pulp_enable_tls | bool else {}
18+
}}
1319
1420
- name: Ensure repository distributions exist
1521
ansible.builtin.import_role:
1622
name: stackhpc.pulp.pulp_distribution
1723
vars:
1824
pulp_distribution_deb: "{{ stackhpc_pulp_distribution_deb_development | selectattr('required') }}"
1925
pulp_distribution_rpm: "{{ stackhpc_pulp_distribution_rpm_development | selectattr('required') }}"
26+
environment: >-
27+
{{
28+
{
29+
'REQUESTS_CA_BUNDLE': stackhpc_requests_ca_bundle
30+
} if pulp_enable_tls | bool else {}
31+
}}
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Sync Pulp repositories
33
hosts: localhost
4-
gather_facts: false
4+
gather_facts: true
55
tasks:
66
- name: Sync Pulp repositories
77
ansible.builtin.import_role:
@@ -10,3 +10,9 @@
1010
vars:
1111
pulp_repository_deb_repos: "{{ stackhpc_pulp_repository_deb_repos | selectattr('required') }}"
1212
pulp_repository_rpm_repos: "{{ stackhpc_pulp_repository_rpm_repos | selectattr('required') }}"
13+
environment: >-
14+
{{
15+
{
16+
'REQUESTS_CA_BUNDLE': stackhpc_requests_ca_bundle
17+
} if pulp_enable_tls else {}
18+
}}

etc/kayobe/pulp.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ stackhpc_release_pulp_content_url_with_auth: "{{ stackhpc_release_pulp_scheme }}
6262
# NOTE: Only RPM repositories are supported.
6363
stackhpc_pulp_sync_for_local_container_build: false
6464

65+
# Set the CA bundle used by Python `requests`.
66+
stackhpc_requests_ca_bundle: >-
67+
{{
68+
'/etc/pki/tls/certs/ca-bundle.crt'
69+
if ansible_facts.os_family == 'RedHat'
70+
else '/etc/ssl/certs/ca-certificates.crt'
71+
}}
72+
6573
###############################################################################
6674
# Debs
6775

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Support use of ``pulp_enable_tls`` in combination with the newer
5+
``pulp`` collection by configuring ``requests`` to use ``CA``
6+
bundle where internal ``PKI`` is configured.

0 commit comments

Comments
 (0)