bootstrap-os: match on os-release ID / VARIANT_ID (#7269)

This fixes deployment with CentOS 8 Streams and make detection more reliable

Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
(cherry picked from commit 95b329b64d)

Conflicts:
  roles/bootstrap-os/tasks/main.yml
This commit is contained in:
Etienne Champetier 2021-02-11 11:14:16 -05:00 committed by Kubernetes Prow Robot
parent d48a4bbc85
commit 60b405a7b7
3 changed files with 20 additions and 18 deletions

View file

@ -22,7 +22,7 @@
dest: /etc/yum.repos.d/public-yum-ol7.repo dest: /etc/yum.repos.d/public-yum-ol7.repo
when: when:
- use_oracle_public_repo|default(true) - use_oracle_public_repo|default(true)
- '"Oracle" in os_release.stdout' - '''ID="ol"'' in os_release.stdout_lines'
- (ansible_distribution_version | float) < 7.6 - (ansible_distribution_version | float) < 7.6
environment: "{{ proxy_env }}" environment: "{{ proxy_env }}"
@ -38,7 +38,7 @@
- ol7_developer_EPEL - ol7_developer_EPEL
when: when:
- use_oracle_public_repo|default(true) - use_oracle_public_repo|default(true)
- '"Oracle" in os_release.stdout' - '''ID="ol"'' in os_release.stdout_lines'
- (ansible_distribution_version | float) < 7.6 - (ansible_distribution_version | float) < 7.6
- name: Enable Oracle Linux repo - name: Enable Oracle Linux repo
@ -52,7 +52,7 @@
- { option: "baseurl", value: "http://yum.oracle.com/repo/OracleLinux/OL{{ ansible_distribution_major_version }}/addons/x86_64/" } - { option: "baseurl", value: "http://yum.oracle.com/repo/OracleLinux/OL{{ ansible_distribution_major_version }}/addons/x86_64/" }
when: when:
- use_oracle_public_repo|default(true) - use_oracle_public_repo|default(true)
- '"Oracle" in os_release.stdout' - '''ID="ol"'' in os_release.stdout_lines'
- (ansible_distribution_version | float) >= 7.6 - (ansible_distribution_version | float) >= 7.6
- name: Install EPEL for Oracle Linux repo package - name: Install EPEL for Oracle Linux repo package
@ -61,7 +61,7 @@
state: present state: present
when: when:
- use_oracle_public_repo|default(true) - use_oracle_public_repo|default(true)
- '"Oracle" in os_release.stdout' - '''ID="ol"'' in os_release.stdout_lines'
- (ansible_distribution_version | float) >= 7.6 - (ansible_distribution_version | float) >= 7.6
# CentOS ships with python installed # CentOS ships with python installed

View file

@ -51,20 +51,20 @@
# This command should always run, even in check mode # This command should always run, even in check mode
check_mode: false check_mode: false
when: when:
- '"bionic" in os_release.stdout' - '''UBUNTU_CODENAME=bionic'' in os_release.stdout_lines'
- name: Change Network Name Resolution configuration - name: Change Network Name Resolution configuration
raw: sed -i 's/^DNSSEC=yes/DNSSEC=allow-downgrade/g' /etc/systemd/resolved.conf raw: sed -i 's/^DNSSEC=yes/DNSSEC=allow-downgrade/g' /etc/systemd/resolved.conf
become: true become: true
when: when:
- '"bionic" in os_release.stdout' - '''UBUNTU_CODENAME=bionic'' in os_release.stdout_lines'
- need_dnssec_allow_downgrade.rc - need_dnssec_allow_downgrade.rc
- name: Restart systemd-resolved service - name: Restart systemd-resolved service
raw: systemctl restart systemd-resolved raw: systemctl restart systemd-resolved
become: true become: true
when: when:
- '"bionic" in os_release.stdout' - '''UBUNTU_CODENAME=bionic'' in os_release.stdout_lines'
- need_dnssec_allow_downgrade.rc - need_dnssec_allow_downgrade.rc
- name: Install python3 - name: Install python3

View file

@ -7,32 +7,34 @@
check_mode: false check_mode: false
- include_tasks: bootstrap-centos.yml - include_tasks: bootstrap-centos.yml
when: '"CentOS" in os_release.stdout or "Oracle" in os_release.stdout' when: '''ID="centos"'' in os_release.stdout_lines or ''ID="ol"'' in os_release.stdout_lines'
- include_tasks: bootstrap-redhat.yml - include_tasks: bootstrap-redhat.yml
when: '"Red Hat Enterprise Linux" in os_release.stdout' when: '''ID="rhel"'' in os_release.stdout_lines'
- include_tasks: bootstrap-clearlinux.yml - include_tasks: bootstrap-clearlinux.yml
when: '"Clear Linux OS" in os_release.stdout' when: '''ID=clear-linux-os'' in os_release.stdout_lines'
# Fedora CoreOS
- include_tasks: bootstrap-fedora-coreos.yml - include_tasks: bootstrap-fedora-coreos.yml
when: '"ID=fedora" in os_release.stdout and "VARIANT_ID=coreos" in os_release.stdout' when:
- '''ID=fedora'' in os_release.stdout_lines'
- '''VARIANT_ID=coreos'' in os_release.stdout_lines'
- include_tasks: bootstrap-flatcar.yml - include_tasks: bootstrap-flatcar.yml
when: when: '''ID=flatcar'' in os_release.stdout_lines'
- '"Flatcar" in os_release.stdout'
- '"ID=fedora" not in os_release.stdout'
- include_tasks: bootstrap-debian.yml - include_tasks: bootstrap-debian.yml
when: '"Debian" in os_release.stdout or "Ubuntu" in os_release.stdout' when: '''ID=debian'' in os_release.stdout_lines or ''ID=ubuntu'' in os_release.stdout_lines'
# Fedora "classic"
- include_tasks: bootstrap-fedora.yml - include_tasks: bootstrap-fedora.yml
when: when:
- '"Fedora" in os_release.stdout' - '''ID=fedora'' in os_release.stdout_lines'
- '"VARIANT_ID=coreos" not in os_release.stdout' - '''VARIANT_ID=coreos'' not in os_release.stdout_lines'
- include_tasks: bootstrap-opensuse.yml - include_tasks: bootstrap-opensuse.yml
when: '"openSUSE" in os_release.stdout' when: '''ID="opensuse-leap"'' in os_release.stdout_lines or ''ID="opensuse-tumbleweed"'' in os_release.stdout_lines'
- name: Create remote_tmp for it is used by another module - name: Create remote_tmp for it is used by another module
file: file: