Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions roles/bootstrap_os/tasks/centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
- name: Gather host facts to get ansible_distribution_version ansible_distribution_major_version
setup:
gather_subset: '!all'
filter: ansible_distribution_*version
filter:
- distribution_version
- distribution_major_version

- name: Add proxy to yum.conf or dnf.conf if http_proxy is defined
community.general.ini_file:
path: "{{ ((ansible_distribution_major_version | int) < 8) | ternary('/etc/yum.conf', '/etc/dnf/dnf.conf') }}"
path: "{{ ((ansible_facts['distribution_major_version'] | int) < 8) | ternary('/etc/yum.conf', '/etc/dnf/dnf.conf') }}"
section: main
option: proxy
value: "{{ http_proxy | default(omit) }}"
Expand All @@ -20,28 +22,28 @@

- name: Install EPEL for Oracle Linux repo package
package:
name: "oracle-epel-release-el{{ ansible_distribution_major_version }}"
name: "oracle-epel-release-el{{ ansible_facts['distribution_major_version'] }}"
state: present
when:
- use_oracle_public_repo
- '''ID="ol"'' in os_release.stdout_lines'
- (ansible_distribution_version | float) >= 7.6
- (ansible_facts['distribution_version'] | float) >= 7.6

- name: Enable Oracle Linux repo
community.general.ini_file:
dest: "/etc/yum.repos.d/oracle-linux-ol{{ ansible_distribution_major_version }}.repo"
section: "ol{{ ansible_distribution_major_version }}_addons"
dest: "/etc/yum.repos.d/oracle-linux-ol{{ ansible_facts['distribution_major_version'] }}.repo"
section: "ol{{ ansible_facts['distribution_major_version'] }}_addons"
option: "{{ item.option }}"
value: "{{ item.value }}"
mode: "0644"
with_items:
- { option: "name", value: "ol{{ ansible_distribution_major_version }}_addons" }
- { option: "name", value: "ol{{ ansible_facts['distribution_major_version'] }}_addons" }
- { option: "enabled", value: "1" }
- { option: "baseurl", value: "http://yum.oracle.com/repo/OracleLinux/OL{{ ansible_distribution_major_version }}/addons/$basearch/" }
- { option: "baseurl", value: "http://yum.oracle.com/repo/OracleLinux/OL{{ ansible_facts['distribution_major_version'] }}/addons/$basearch/" }
when:
- use_oracle_public_repo
- '''ID="ol"'' in os_release.stdout_lines'
- (ansible_distribution_version | float) >= 7.6
- (ansible_facts['distribution_version'] | float) >= 7.6

- name: Enable Centos extra repo for Oracle Linux
community.general.ini_file:
Expand All @@ -51,15 +53,15 @@
value: "{{ item.value }}"
mode: "0644"
with_items:
- { option: "name", value: "CentOS-{{ ansible_distribution_major_version }} - Extras" }
- { option: "name", value: "CentOS-{{ ansible_facts['distribution_major_version'] }} - Extras" }
- { option: "enabled", value: "1" }
- { option: "gpgcheck", value: "0" }
- { option: "baseurl", value: "http://mirror.centos.org/centos/{{ ansible_distribution_major_version }}/extras/$basearch/os/" }
- { option: "baseurl", value: "http://mirror.centos.org/centos/{{ ansible_facts['distribution_major_version'] }}/extras/$basearch/os/" }
when:
- use_oracle_public_repo
- '''ID="ol"'' in os_release.stdout_lines'
- (ansible_distribution_version | float) >= 7.6
- (ansible_distribution_version | float) < 9
- (ansible_facts['distribution_version'] | float) >= 7.6
- (ansible_facts['distribution_version'] | float) < 9

# CentOS ships with python installed

Expand Down
4 changes: 3 additions & 1 deletion roles/bootstrap_os/tasks/opensuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
- name: Gather host facts to get ansible_distribution_version ansible_distribution_major_version
setup:
gather_subset: '!all'
filter: ansible_distribution_*version
filter:
- distribution_version
- distribution_major_version

- name: Check that /etc/sysconfig/proxy file exists
stat:
Expand Down
8 changes: 5 additions & 3 deletions roles/bootstrap_os/tasks/rhel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
- name: Gather host facts to get ansible_distribution_version ansible_distribution_major_version
setup:
gather_subset: '!all'
filter: ansible_distribution_*version
filter:
- distribution_version
- distribution_major_version

- name: Add proxy to yum.conf or dnf.conf if http_proxy is defined
community.general.ini_file:
path: "{{ ((ansible_distribution_major_version | int) < 8) | ternary('/etc/yum.conf', '/etc/dnf/dnf.conf') }}"
path: "{{ ((ansible_facts['distribution_major_version'] | int) < 8) | ternary('/etc/yum.conf', '/etc/dnf/dnf.conf') }}"
section: main
option: proxy
value: "{{ http_proxy | default(omit) }}"
Expand Down Expand Up @@ -71,7 +73,7 @@
- "rhel-8-for-*-appstream-rpms"
state: "{{ 'enabled' if (rhel_enable_repos | bool) else 'disabled' }}"
when:
- ansible_distribution_major_version == "8"
- ansible_facts['distribution_major_version'] == "8"
- (not rh_subscription_status.changed) or (rh_subscription_username is defined) or (rh_subscription_org_id is defined)

- name: Check presence of fastestmirror.conf
Expand Down