2016-12-08 00:16:06 +08:00
|
|
|
---
|
2019-04-24 06:46:02 +08:00
|
|
|
# CentOS ships with python installed
|
|
|
|
|
|
|
|
- name: Check if this is an atomic host
|
2018-12-11 18:43:21 +08:00
|
|
|
stat:
|
|
|
|
path: /run/ostree-booted
|
|
|
|
register: ostree
|
|
|
|
|
2019-04-24 06:46:02 +08:00
|
|
|
- name: Store the fact if this is an atomic host
|
|
|
|
set_fact:
|
2018-12-11 18:43:21 +08:00
|
|
|
is_atomic: "{{ ostree.stat.exists }}"
|
2016-12-08 00:16:06 +08:00
|
|
|
|
|
|
|
- name: Check presence of fastestmirror.conf
|
2017-02-18 05:22:34 +08:00
|
|
|
stat:
|
|
|
|
path: /etc/yum/pluginconf.d/fastestmirror.conf
|
2016-12-08 00:16:06 +08:00
|
|
|
register: fastestmirror
|
|
|
|
|
2019-04-24 06:46:02 +08:00
|
|
|
# the fastestmirror plugin can actually slow down Ansible deployments
|
|
|
|
- name: Disable fastestmirror plugin if requested
|
2016-12-08 00:16:06 +08:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/yum/pluginconf.d/fastestmirror.conf
|
|
|
|
regexp: "^enabled=.*"
|
|
|
|
line: "enabled=0"
|
|
|
|
state: present
|
2019-02-12 06:04:27 +08:00
|
|
|
become: true
|
2019-04-24 06:46:02 +08:00
|
|
|
when:
|
|
|
|
- fastestmirror.stat.exists
|
|
|
|
- not centos_fastestmirror_enabled
|
2017-04-21 00:17:01 +08:00
|
|
|
|
2018-11-07 14:44:37 +08:00
|
|
|
- name: Add proxy to /etc/yum.conf if http_proxy is defined
|
|
|
|
lineinfile:
|
|
|
|
path: "/etc/yum.conf"
|
2019-02-12 06:04:27 +08:00
|
|
|
line: "proxy={{ http_proxy }}"
|
2019-04-24 06:46:02 +08:00
|
|
|
create: true
|
2019-02-12 06:04:27 +08:00
|
|
|
state: present
|
|
|
|
become: true
|
2018-12-11 18:43:21 +08:00
|
|
|
when:
|
2019-04-24 06:46:02 +08:00
|
|
|
- http_proxy is defined
|
2019-02-12 05:27:02 +08:00
|
|
|
|
2019-04-24 06:46:02 +08:00
|
|
|
# libselinux-python is required on SELinux enabled hosts
|
|
|
|
# See https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements
|
|
|
|
- name: Install libselinux-python
|
|
|
|
package:
|
|
|
|
name: libselinux-python
|
2017-10-14 16:52:40 +08:00
|
|
|
state: present
|
2019-02-12 06:04:27 +08:00
|
|
|
become: true
|
2018-12-11 18:43:21 +08:00
|
|
|
when:
|
|
|
|
- not is_atomic
|