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>
pull/7284/head
Etienne Champetier 2021-02-11 11:14:16 -05:00 committed by GitHub
parent de1d9df787
commit 95b329b64d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 18 deletions

View File

@ -22,7 +22,7 @@
dest: /etc/yum.repos.d/public-yum-ol7.repo
when:
- use_oracle_public_repo|default(true)
- '"Oracle" in os_release.stdout'
- '''ID="ol"'' in os_release.stdout_lines'
- (ansible_distribution_version | float) < 7.6
environment: "{{ proxy_env }}"
@ -38,7 +38,7 @@
- ol7_developer_EPEL
when:
- use_oracle_public_repo|default(true)
- '"Oracle" in os_release.stdout'
- '''ID="ol"'' in os_release.stdout_lines'
- (ansible_distribution_version | float) < 7.6
- 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/" }
when:
- use_oracle_public_repo|default(true)
- '"Oracle" in os_release.stdout'
- '''ID="ol"'' in os_release.stdout_lines'
- (ansible_distribution_version | float) >= 7.6
- name: Install EPEL for Oracle Linux repo package
@ -61,7 +61,7 @@
state: present
when:
- use_oracle_public_repo|default(true)
- '"Oracle" in os_release.stdout'
- '''ID="ol"'' in os_release.stdout_lines'
- (ansible_distribution_version | float) >= 7.6
# CentOS ships with python installed

View File

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

View File

@ -7,32 +7,34 @@
check_mode: false
- 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
when: '"Red Hat Enterprise Linux" in os_release.stdout and "CentOS" not in os_release.stdout'
when: '''ID="rhel"'' in os_release.stdout_lines'
- 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
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
when:
- '"Flatcar" in os_release.stdout'
- '"ID=fedora" not in os_release.stdout'
when: '''ID=flatcar'' in os_release.stdout_lines'
- 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
when:
- '"Fedora" in os_release.stdout'
- '"VARIANT_ID=coreos" not in os_release.stdout'
- '''ID=fedora'' in os_release.stdout_lines'
- '''VARIANT_ID=coreos'' not in os_release.stdout_lines'
- 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
file: