Skip to content

Commit

Permalink
Fix python3-libselinux installation for RHEL/CentOS 8
Browse files Browse the repository at this point in the history
In bootstrap-centos.yml we haven't gathered the facts,
so kubernetes-sigs#5127 couldn't work

Minimum ansible version to run kubespray is 2.7.8,
so ansible_distribution_major_version is defined an there is no need to default it

Signed-off-by: Etienne Champetier <[email protected]>
  • Loading branch information
champtar committed Sep 27, 2019
1 parent 8712bdd commit 506661c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion roles/bootstrap-os/tasks/bootstrap-centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@
when:
- http_proxy is defined

- name: Gather host facts to get ansible_distribution_major_version
setup:
gather_subset: '!all'
filter: ansible_distribution_major_version

# libselinux-python is required on SELinux enabled hosts
# See https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements
- name: Install libselinux python package
package:
name: "{{ ( (ansible_facts.distribution_major_version | default(0) | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
name: "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
state: present
become: true
when:
Expand Down
2 changes: 1 addition & 1 deletion roles/kubernetes/preinstall/vars/centos.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
required_pkgs:
- "{{ ( (ansible_facts.distribution_major_version | default(0) | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
- "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
- device-mapper-libs
- ebtables
- nss
2 changes: 1 addition & 1 deletion roles/kubernetes/preinstall/vars/redhat.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
required_pkgs:
- "{{ ( (ansible_facts.distribution_major_version | default(0) | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
- "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
- device-mapper-libs
- ebtables
- nss

0 comments on commit 506661c

Please sign in to comment.