mariancraciun1983.install_python

Python Installer Ansible Role



This Ansible role helps you install Python 2 or 3 on remote hosts that don’t have Python yet.

Introduction

If Python isn’t installed on the host machine, many Ansible functionalities and modules won’t work. Modules like yum, apt, and set_fact need Python to be installed first. This role uses the raw module to check for and install Python.

Ansible

This role has been tested with Ansible versions 2.7, 2.8, 2.9, and 2.10. It supports the following platforms:

  • Debian
    • buster
    • stretch
  • Ubuntu
    • focal
    • bionic
    • xenial
  • CentOS
    • 8
    • 7

Variables

There is one variable named install_python_package:

install_python_package: python3

For Python 2, since the package names differ, you can use the following suggestions:

group_vars:
  all:
    install_python_package: python2
host_vars:
  stretch:
    install_python_package: python
  bionic:
    install_python_package: python
  xenial:
    install_python_package: python

Example

# inventory
[servers]
focal.example.com install_python_package=python2
stretch.example.com install_python_package=python
# playbook.yml
- hosts: servers
  gather_facts: no
  roles:
    - mariancraciun1983.install_python
# install the role
ansible-galaxy install mariancraciun1983.install_python
# run the playbook
ansible-playbook -i inventory playbook.yml

License

MIT License

Informazioni sul progetto

Install python 2 or 3 using the raw module where the remote system has no python installed

Installa
ansible-galaxy install mariancraciun1983.install_python
Licenza
mit
Download
939
Proprietario
¯\_(ツ)_/¯