diff --git a/roles/bootstrap-os/tasks/bootstrap-centos.yml b/roles/bootstrap-os/tasks/bootstrap-centos.yml index 2295d8a1e..eb433720f 100644 --- a/roles/bootstrap-os/tasks/bootstrap-centos.yml +++ b/roles/bootstrap-os/tasks/bootstrap-centos.yml @@ -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 diff --git a/roles/bootstrap-os/tasks/bootstrap-debian.yml b/roles/bootstrap-os/tasks/bootstrap-debian.yml index c4e74e301..82145ba01 100644 --- a/roles/bootstrap-os/tasks/bootstrap-debian.yml +++ b/roles/bootstrap-os/tasks/bootstrap-debian.yml @@ -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 diff --git a/roles/bootstrap-os/tasks/main.yml b/roles/bootstrap-os/tasks/main.yml index 98d7672f5..7b8ffb10e 100644 --- a/roles/bootstrap-os/tasks/main.yml +++ b/roles/bootstrap-os/tasks/main.yml @@ -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' + 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: