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
|
|
|
|
|
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"
|
|
|
|
section: "{{ item }}"
|
|
|
|
option: enabled
|
|
|
|
value: "1"
|
|
|
|
with_items:
|
|
|
|
- "ol{{ ansible_distribution_major_version }}_addons"
|
|
|
|
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
|
|
|
|
2018-11-07 06:44:37 +00:00
|
|
|
- name: Add proxy to /etc/yum.conf if http_proxy is defined
|
2020-04-09 08:25:44 +00:00
|
|
|
ini_file:
|
2018-11-07 06:44:37 +00:00
|
|
|
path: "/etc/yum.conf"
|
2020-04-09 08:25:44 +00:00
|
|
|
section: main
|
|
|
|
option: proxy
|
|
|
|
value: "{{ http_proxy | default(omit) }}"
|
|
|
|
state: "{{ http_proxy | default(False) | ternary('present', 'absent') }}"
|
|
|
|
no_extra_spaces: true
|
2019-02-11 22:04:27 +00:00
|
|
|
become: true
|
2019-02-11 21:27:02 +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
|