项目作者: kerns-ai-lab

项目描述 :
Python ansible role
高级语言:
项目地址: git://github.com/kerns-ai-lab/ansible-role-python.git
创建时间: 2020-01-19T22:43:47Z
项目社区:https://github.com/kerns-ai-lab/ansible-role-python

开源协议:

下载


Python Ansible Role

Installs Python, Python3 and related packages

Requirements

This role requires Ansible 2.0 or higher.

Role Variables

Defaults

  1. - name: python2_install
  2. desc: Flag determining if python 2 should be installed
  3. default: True
  4. - name: python3_install
  5. desc: Flag determining if python 3 should be installed
  6. default: True
  7. - name: python3_version
  8. desc: Target python3 version to install (if not the default latest for distro)
  9. default: 3
  10. - name: python_pip_executable
  11. desc: Target pip executable to use for package installations (pip3 for python3 installs)
  12. default: pip3
  13. - name: python_pip_packages_extra
  14. desc: List of pip packages to install on top of base python packages required for development
  15. default: []

Vars

These are not meant to be modified

  1. - name: python3_package
  2. desc: Target Python3 executable apt package
  3. value: "python{{ python3_version }}"
  4. - name: python2_packages
  5. desc: Python2 development packages
  6. value:
  7. - python
  8. - python-dev
  9. - python-pip
  10. - name: python3_packages
  11. desc: Python3 development packages
  12. value:
  13. - "{{ python3_package }}"
  14. - python3-dev
  15. - python3-pip
  16. - name: python_pip_packages
  17. desc: Python pip packages to install alongside base executable
  18. value:
  19. - virtualenv
  20. - setuptools
  21. - pipenv
  22. - "{{ python_pip_packages_extra }}"

Dependencies

None

Example Playbook

Install Python2 & Python3

  1. - hosts: all
  2. roles:
  3. - ansible-role-python

Install Python2 only

  1. - hosts: all
  2. vars:
  3. python3_install: False
  4. roles:
  5. - ansible-role-python

Testing

Tests can be executed with local vagrantfile using the command. This mounts the role directory in the guest and executes the role via the playbook in tests/ folder.

  1. vagrant up