From 42cf8e680a39895d991c4eaff114062780510c47 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Thu, 11 Oct 2018 12:38:23 -0400 Subject: [PATCH] Add ensure-python role ensure-python allows for installation of a specific version of the python interpreter and development files. Add this role to tox pre.yaml. Change-Id: Ia56cba58c87aa48de3e8e3f3d28f6252f7dcd7c3 --- playbooks/tox/pre.yaml | 1 + roles/ensure-python/README.rst | 10 ++++++++++ roles/ensure-python/tasks/main.yaml | 6 ++++++ 3 files changed, 17 insertions(+) create mode 100644 roles/ensure-python/README.rst create mode 100644 roles/ensure-python/tasks/main.yaml diff --git a/playbooks/tox/pre.yaml b/playbooks/tox/pre.yaml index 69e7def02..87e13883d 100644 --- a/playbooks/tox/pre.yaml +++ b/playbooks/tox/pre.yaml @@ -1,3 +1,4 @@ - hosts: all roles: - ensure-tox + - ensure-python diff --git a/roles/ensure-python/README.rst b/roles/ensure-python/README.rst new file mode 100644 index 000000000..029398029 --- /dev/null +++ b/roles/ensure-python/README.rst @@ -0,0 +1,10 @@ +Ensure specified python interpreter and development files are installed + +.. note:: This role is only available for Debian based platforms + currently. + +**Role Variables** + +.. zuul:rolevar:: python_version + + Optional version of python interpreter to install, such as ``3.7``. diff --git a/roles/ensure-python/tasks/main.yaml b/roles/ensure-python/tasks/main.yaml new file mode 100644 index 000000000..7b3a59487 --- /dev/null +++ b/roles/ensure-python/tasks/main.yaml @@ -0,0 +1,6 @@ +- name: Install specified version of python interpreter and development files + when: python_version is defined + package: + name: python{{ python_version }}-dev + state: present + become: yes