Skip to content

Commit c13da84

Browse files
evallespopenshift-merge-bot[bot]
authored andcommitted
[install_ca] Adding wait CA URL before installing internal CA
If we install internal CA early, we might find a race condition of DNS already not set up. This makes to check for DNS resolution before continue to install the certificate. Just checking the name resolving is working. Signed-off-by: Enrique Vallespi Gil <evallesp@redhat.com>
1 parent 8a1e237 commit c13da84

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

roles/install_ca/tasks/main.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,26 @@
2525

2626
- name: Install internal CA from url
2727
when: cifmw_install_ca_url is defined
28-
ansible.builtin.get_url:
29-
url: "{{ cifmw_install_ca_url }}"
30-
dest: "{{ cifmw_install_ca_trust_dir }}"
31-
validate_certs: "{{ cifmw_install_ca_url_validate_certs | default(omit) }}"
32-
mode: "0644"
28+
block:
29+
- name: Wait until CA URL is reachable
30+
ansible.builtin.uri:
31+
url: "{{ cifmw_install_ca_url }}"
32+
method: HEAD
33+
validate_certs: false
34+
follow_redirects: all
35+
status_code: [200, 301, 302, 303, 307, 308, 401, 403, 404, 405]
36+
register: _cifmw_install_ca_dns_wait
37+
until: _cifmw_install_ca_dns_wait is succeeded
38+
retries: 30
39+
delay: 10
40+
changed_when: false
41+
42+
- name: Install internal CA from url
43+
ansible.builtin.get_url:
44+
url: "{{ cifmw_install_ca_url }}"
45+
dest: "{{ cifmw_install_ca_trust_dir }}"
46+
validate_certs: "{{ cifmw_install_ca_url_validate_certs | default(omit) }}"
47+
mode: "0644"
3348

3449
- name: Install custom CA bundle from inline
3550
register: ca_inline

0 commit comments

Comments
 (0)