klaus385 / ansible-python3-role

Ansible role for installing Python 3.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python3

Travis CI build status

This Ansible role will install Python 3, pip, and virtualenv.

Although the pip and virtualenv command-line tools will be installed, the recommended way to invoke them is as modules to ensure that the expected version is used:

$ python3 -m pip install <package>
$ python3 -m venv <dir>

The role currently assumes that the user's login shell is bash and modifies startup files accordingly.

By default, Python is installed from packages. If the python3_pyenv variable is set, pyenv will be installed and then used to install the requested Python version, from source if necessary. A pyenv install is only visible for the current Ansible user (the login user by default). The role will not activate the new Python; see the pyenv documentation for ways to do this.

This role is also available on Ansible Galaxy.

Using the Role

Role Variables

  • python3_command: Python command name
  • python3_bashrc: login file to modify; defaults to bash_profile
  • python3_local: local binary directory; system-dependent
  • python3_pyenv: Python version to install using pyenv

Example Playbook

- hosts: all

  roles:
    - name: python3
      python3_pyenv: "3.6.4"

Development

Use the task script to run development tasks:

  • dev: Create the local development environment
  • test: Run the Molecule test suite

About

Ansible role for installing Python 3.

License:MIT License


Languages

Language:Python 60.7%Language:Shell 39.3%