2018-09-20 01:57:20 +08:00
|
|
|
---
|
2019-04-24 06:46:02 +08:00
|
|
|
# Some Fedora based distros ship without Python installed
|
|
|
|
|
2019-02-12 06:04:27 +08:00
|
|
|
- name: Check if bootstrap is needed
|
2019-04-24 06:46:02 +08:00
|
|
|
raw: which python
|
2018-09-20 01:57:20 +08:00
|
|
|
register: need_bootstrap
|
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
2018-10-20 22:13:54 +08:00
|
|
|
environment: {}
|
2019-04-24 06:46:02 +08:00
|
|
|
tags:
|
|
|
|
- facts
|
2018-09-20 01:57:20 +08:00
|
|
|
|
2019-05-03 03:28:22 +08:00
|
|
|
- name: Check if a proxy is set in /etc/dnf/dnf.conf
|
|
|
|
raw: grep -qs 'proxy=' /etc/dnf/dnf.conf
|
|
|
|
register: need_http_proxy
|
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
|
|
|
# This command should always run, even in check mode
|
|
|
|
check_mode: false
|
|
|
|
environment: {}
|
|
|
|
when:
|
|
|
|
- http_proxy is defined
|
|
|
|
|
|
|
|
- name: Add http_proxy to /etc/dnf/dnf.conf if http_proxy is defined
|
|
|
|
raw: echo 'proxy={{ http_proxy }}' >> /etc/dnf/dnf.conf
|
|
|
|
become: true
|
|
|
|
environment: {}
|
|
|
|
when:
|
|
|
|
- http_proxy is defined
|
|
|
|
- need_http_proxy.rc != 0
|
|
|
|
|
2019-04-24 06:46:02 +08:00
|
|
|
# Fedora's policy as of Fedora 30 is to still install python2 as /usr/bin/python
|
|
|
|
# See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 for the current status
|
2018-09-20 01:57:20 +08:00
|
|
|
- name: Install python on fedora
|
2019-04-24 06:46:02 +08:00
|
|
|
raw: "dnf install --assumeyes --quiet python2"
|
2019-02-12 06:04:27 +08:00
|
|
|
become: true
|
2018-10-20 22:13:54 +08:00
|
|
|
environment: {}
|
2019-04-24 06:46:02 +08:00
|
|
|
when:
|
|
|
|
- need_bootstrap.rc != 0
|
2018-09-20 01:57:20 +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:
|
2018-09-20 01:57:20 +08:00
|
|
|
name: libselinux-python
|
|
|
|
state: present
|
2019-02-12 06:04:27 +08:00
|
|
|
become: true
|