2016-12-07 16:16:06 +00:00
|
|
|
---
|
2020-06-12 08:59:56 +00:00
|
|
|
- name: Gather host facts to get ansible_distribution_version ansible_distribution_major_version
|
|
|
|
setup:
|
|
|
|
gather_subset: '!all'
|
|
|
|
filter: ansible_distribution_*version
|
|
|
|
|
2021-01-07 18:50:53 +00:00
|
|
|
- name: Add proxy to yum.conf or dnf.conf if http_proxy is defined
|
|
|
|
ini_file:
|
|
|
|
path: "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('/etc/yum.conf','/etc/dnf/dnf.conf') }}"
|
|
|
|
section: main
|
|
|
|
option: proxy
|
|
|
|
value: "{{ http_proxy | default(omit) }}"
|
|
|
|
state: "{{ http_proxy | default(False) | ternary('present', 'absent') }}"
|
|
|
|
no_extra_spaces: true
|
|
|
|
become: true
|
|
|
|
when: not skip_http_proxy_on_os_packages
|
|
|
|
|
2020-03-14 13:28:34 +00:00
|
|
|
# For Oracle Linux install public repo
|
|
|
|
- name: Download Oracle Linux public yum repo
|
|
|
|
get_url:
|
|
|
|
url: https://yum.oracle.com/public-yum-ol7.repo
|
|
|
|
dest: /etc/yum.repos.d/public-yum-ol7.repo
|
|
|
|
when:
|
|
|
|
- use_oracle_public_repo|default(true)
|
|
|
|
- '"Oracle" in os_release.stdout'
|
2020-06-12 08:59:56 +00:00
|
|
|
- (ansible_distribution_version | float) < 7.6
|
2020-03-14 13:28:34 +00:00
|
|
|
|
|
|
|
- name: Enable Oracle Linux repo
|
|
|
|
ini_file:
|
|
|
|
dest: /etc/yum.repos.d/public-yum-ol7.repo
|
|
|
|
section: "{{ item }}"
|
|
|
|
option: enabled
|
|
|
|
value: "1"
|
|
|
|
with_items:
|
|
|
|
- ol7_latest
|
|
|
|
- ol7_addons
|
|
|
|
- ol7_developer_EPEL
|
|
|
|
when:
|
|
|
|
- use_oracle_public_repo|default(true)
|
|
|
|
- '"Oracle" in os_release.stdout'
|
2020-06-12 08:59:56 +00:00
|
|
|
- (ansible_distribution_version | float) < 7.6
|
|
|
|
|
|
|
|
- name: Enable Oracle Linux repo
|
|
|
|
ini_file:
|
|
|
|
dest: "/etc/yum.repos.d/oracle-linux-ol{{ ansible_distribution_major_version }}.repo"
|
2020-09-07 08:15:41 +00:00
|
|
|
section: "ol{{ ansible_distribution_major_version }}_addons"
|
|
|
|
option: "{{ item.option }}"
|
|
|
|
value: "{{ item.value }}"
|
2020-06-12 08:59:56 +00:00
|
|
|
with_items:
|
2020-09-07 08:15:41 +00:00
|
|
|
- { option: "enabled", value: "1" }
|
|
|
|
- { option: "baseurl", value: "http://yum.oracle.com/repo/OracleLinux/OL{{ ansible_distribution_major_version }}/addons/x86_64/" }
|
2020-06-12 08:59:56 +00:00
|
|
|
when:
|
|
|
|
- '"Oracle" in os_release.stdout'
|
|
|
|
- (ansible_distribution_version | float) >= 7.6
|
|
|
|
|
|
|
|
- name: Install EPEL for Oracle Linux repo package
|
|
|
|
package:
|
|
|
|
name: "oracle-epel-release-el{{ ansible_distribution_major_version }}"
|
|
|
|
state: present
|
|
|
|
when:
|
|
|
|
- '"Oracle" in os_release.stdout'
|
|
|
|
- (ansible_distribution_version | float) >= 7.6
|
2020-03-14 13:28:34 +00:00
|
|
|
|
2019-04-23 22:46:02 +00:00
|
|
|
# CentOS ships with python installed
|
|
|
|
|
2016-12-07 16:16:06 +00:00
|
|
|
- name: Check presence of fastestmirror.conf
|
2017-02-17 21:22:34 +00:00
|
|
|
stat:
|
|
|
|
path: /etc/yum/pluginconf.d/fastestmirror.conf
|
2016-12-07 16:16:06 +00:00
|
|
|
register: fastestmirror
|
|
|
|
|
2019-04-23 22:46:02 +00:00
|
|
|
# the fastestmirror plugin can actually slow down Ansible deployments
|
|
|
|
- name: Disable fastestmirror plugin if requested
|
2016-12-07 16:16:06 +00:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/yum/pluginconf.d/fastestmirror.conf
|
|
|
|
regexp: "^enabled=.*"
|
|
|
|
line: "enabled=0"
|
|
|
|
state: present
|
2019-02-11 22:04:27 +00:00
|
|
|
become: true
|
2019-04-23 22:46:02 +00:00
|
|
|
when:
|
|
|
|
- fastestmirror.stat.exists
|
|
|
|
- not centos_fastestmirror_enabled
|
2017-04-20 16:17:01 +00:00
|
|
|
|
2019-04-23 22:46:02 +00:00
|
|
|
# libselinux-python is required on SELinux enabled hosts
|
|
|
|
# See https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements
|
2019-08-28 09:33:15 +00:00
|
|
|
- name: Install libselinux python package
|
2019-04-23 22:46:02 +00:00
|
|
|
package:
|
2019-12-09 09:37:10 +00:00
|
|
|
name: "{{ ( (ansible_distribution_major_version | int) < 8) | ternary('libselinux-python','python3-libselinux') }}"
|
2017-10-14 08:52:40 +00:00
|
|
|
state: present
|
2019-02-11 22:04:27 +00:00
|
|
|
become: true
|