Skip to content

Commit fab0c61

Browse files
committed
fix: when in fips mode and in a disconnected environment, remove the non fips openshift-install
Signed-off-by: Paul Bastide <[email protected]>
1 parent e1ae35b commit fab0c61

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

playbooks/roles/ocp-config/tasks/extract.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
args:
3232
chdir: "{{ tools_dir }}"
3333

34+
- name: Extract OCP4 tools from release image ( local-registry )
35+
when: enable_local_registry
36+
shell: |
37+
oc adm release extract --tools {{ release_image_override }} --registry-config='{{ ansible_env.HOME }}/.openshift/pull-secret-updated'
38+
args:
39+
chdir: "{{ tools_dir }}"
40+
3441
- name: Create pull-secret file
3542
when: not enable_local_registry
3643
copy:
@@ -57,6 +64,35 @@
5764
remote_src: yes
5865
with_items: "{{ find_result.files }}"
5966

67+
68+
- name: Check if FIPS is enabled
69+
ansible.builtin.command: grep -q 1 /proc/sys/crypto/fips_enabled
70+
register: fips_check
71+
changed_when: false
72+
failed_when: false
73+
74+
- name: Check if openshift-install binary exists
75+
ansible.builtin.stat:
76+
path: "/usr/local/bin/openshift-install"
77+
register: binary_check
78+
79+
- name: Remove openshift-install binary when FIPS is enabled
80+
ansible.builtin.file:
81+
path: "/usr/local/bin/openshift-install"
82+
state: absent
83+
when:
84+
- fips_check.rc == 0 # FIPS is enabled (returns 1 when enabled)
85+
- binary_check.stat.exists
86+
87+
- name: Link openshift-install-fips to openshift-install
88+
file:
89+
src: "/usr/local/bin/openshift-install-fips"
90+
dest: "/usr/local/bin/openshift-install"
91+
state: link
92+
when:
93+
- fips_check.rc == 0 # FIPS is enabled (returns 1 when enabled)
94+
- binary_check.stat.exists
95+
6096
- name: Remove tools directory
6197
file:
6298
path: "{{ tools_dir }}"

0 commit comments

Comments
 (0)