dragon-bn / ansible-role-ansible_python

This Ansible role uses the raw module to install python on a system where python is missing.

Repository from Github https://github.comdragon-bn/ansible-role-ansible_pythonRepository from Github https://github.comdragon-bn/ansible-role-ansible_python

Ansible Role: ansible_python

Build Status GitHub tag (latest by date) License

Ansible needs Python 2 (version 2.6 or later) or Python 3 (version 3.5 or later) in order to work. But Python is not preinstalled on some Linux Distributions or Docker images (like on Ubuntu images). To prevent manual installation of Python on such systems, this Ansible role uses the raw module (which does not require Python) to install the Python2 or the Python3 package. Ansible can then be used normally on these systems.

You should execute this role as pre_tasks statement with gather_facts set to false like in the example below.

The supported Linux distributions for this role are:

  • Alpine Linux 3.9,
  • Alpine Linux 3.10,
  • Alpine Linux 3.11,
  • Alpine Linux 3.12,
  • Alpine Linux 3.13,
  • Debian 8 (Jessie),
  • Debian 9 (Stretch),
  • Debian 10 (Buster),
  • Enterprise Linux 7,
  • Enterprise Linux 8,
  • Fedora 32,
  • Fedora 33,
  • Fedora 34,
  • Ubuntu 16.04 LTS (Xenial Xerus),
  • Ubuntu 18.04 LTS (Bionic Beaver) and
  • Ubuntu 20.04 LTS (Focal Fossa).

The role was tested with Molecule and Docker on Travis-CI and with this Multi-VM Vagrant environment.

Requirements

None.

Role Variables

None.

Dependencies

None.

Example

---

- hosts: all
  become: true
  # switch gather facts off, becauѕe gather facts needs python
  gather_facts: false
  pre_tasks:
    - name: "Install python if needed"
      include_role:
        name: "coglinev3.ansible_python"
    - name: Gather facts
      setup: # switch gather facts on
  tasks:
    - name: Your other tasks comes here

Version

Release: 1.7.0

License

BSD

Author Information

This Ansible Role was created in 2020, by Cogline.v3.

About

This Ansible role uses the raw module to install python on a system where python is missing.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Shell 100.0%