---
# Installs Python 2 and the libraries needed by Ansible modules.

- name: install python 2.7
  raw: sudo dnf install -y python2

- name: collect facts
  setup:

- name: install dnf-python
  when: ansible_pkg_mgr == 'dnf'
  become: true
  become_user: root
  command: dnf install -y python2-dnf
  register: dnf_install_python_result
  changed_when: '"Nothing to do" not in dnf_install_python_result.stdout'

- name: install dnf packages needed by ansible
  when: ansible_pkg_mgr == 'dnf'
  become: true
  become_user: root
  dnf: name={{ item }} state=present
  with_items:
  - libsemanage-python
  - libselinux-python
  - python-firewall

---
# Installs Python 2 and the libraries needed by Ansible modules.

- name: install python 2.7
  become: true
  become_user: root
  raw: dnf install -y python2 python-simplejson

- name: collect facts
  setup:

- name: install dnf-python
  when: ansible_pkg_mgr == 'dnf'
  become: true
  become_user: root
  command: dnf install -y python2-dnf
  register: dnf_install_python_result
  changed_when: '"Nothing to do" not in dnf_install_python_result.stdout'

- name: install dnf packages needed by ansible
  when: ansible_pkg_mgr == 'dnf'
  become: true
  become_user: root
  dnf: name={{ item }} state=present
  with_items:
  - libsemanage-python
  - libselinux-python
  - python-firewall

Fix python2 installation stanza for Ansible.
Fix python2 installation stanza for Ansible.
