diff --git a/docs/releasenotes.rst b/docs/releasenotes.rst index b18ddab5d599759d617e59e862b8e4977ebe0efc..4c03089af14e139901693cde8cbfc931dbf18107 100644 --- a/docs/releasenotes.rst +++ b/docs/releasenotes.rst @@ -39,6 +39,11 @@ New features/improvements: check. E.g. mails are sent out only in case some of the configured certificates will expire within next 30 days. +* ``wsgi_website`` role + + * Support for specifying Python version for Python virtual + environment. + 2.0.0 ----- diff --git a/docs/rolereference.rst b/docs/rolereference.rst index ccd94bd0068ea43c3f230414e1515229d1b3c357..7ce18ec09981b14fff4ddc8323099ab8c8424b1e 100644 --- a/docs/rolereference.rst +++ b/docs/rolereference.rst @@ -1645,9 +1645,10 @@ The role implements the following: * Adds website administrator to website's group, so administrator could manage the code and data. * Installs additional packages required for running the role (as configured). -* Sets-up a dedicated Python virtual environment for website. +* Sets-up a dedicated Python virtual environment for website. Python + version can be specified (default is Python 2). * Install ``futures`` package in Python virtual environment (required for - Gunicorn in combination withg Python 2.7). + Gunicorn in combination with Python 2.7). * Install Gunicorn in Python virtual environment. * Installs additional packages required for running the role in Python virtual environment (as configured). @@ -1758,11 +1759,11 @@ Parameters for calculating the user/group name for dedicated website user, as well as home directory of the website user (where data/code should be stored at). -**futures_version** (string, optional, ``3.1.1``) +**futures_version** (string, optional, ``3.2.0``) Version of ``futures`` package to deploy in virtual environment. Required by Gunicorn when using Python 2.7. Default version is tested with the test site. -**gunicorn_version** (string, optional, ``19.7.1``) +**gunicorn_version** (string, optional, ``19.9.0``) Version of Gunicorn to deploy in virtual environment for running the WSGI application. Default version is tested with the test site. @@ -1786,6 +1787,9 @@ Parameters forget to surround them by another set of quotes for YAML syntax, for example ``"\"\""`` or ``'""'``). +**python_version** (string, optional, ``2``) + Python version to use when setting-up the Python virtual environment. + **rewrites** (list, optional, ``[]``) A list of rewrite rules that are applied to incoming requests. Each element of the list should be a string value compatible with the format of ``nginx`` diff --git a/roles/wsgi_website/defaults/main.yml b/roles/wsgi_website/defaults/main.yml index e6d8898bd847f20f414bccf22e173e755fdfec82..27fe4ec967bcfcb691e3ab8abf945de37ed9ecb5 100644 --- a/roles/wsgi_website/defaults/main.yml +++ b/roles/wsgi_website/defaults/main.yml @@ -10,14 +10,16 @@ virtualenv_packages: [] environment_variables: {} https_tls_certificate: "{{ lookup('file', tls_certificate_dir + '/' + fqdn + '_https.pem') }}" https_tls_key: "{{ lookup('file', tls_private_key_dir + '/' + fqdn + '_https.key') }}" -gunicorn_version: "19.7.1" -futures_version: "3.1.1" +gunicorn_version: "19.9.0" +futures_version: "3.2.0" website_mail_recipients: "root" environment_indicator: null proxy_headers: {} +python_version: 2 wsgi_requirements: [] # Internal parameters. admin: "admin-{{ fqdn | replace('.', '_') }}" user: "web-{{ fqdn | replace('.', '_') }}" home: "/var/www/{{ fqdn }}" +python_interpreter: "/usr/bin/python{{ python_version }}" diff --git a/roles/wsgi_website/molecule/default/playbook.yml b/roles/wsgi_website/molecule/default/playbook.yml index 05ee8867ba63c15c189bcb14d3b212537eda4fa4..e183f522738307ea147c0f6a7abf6592b37674c1 100644 --- a/roles/wsgi_website/molecule/default/playbook.yml +++ b/roles/wsgi_website/molecule/default/playbook.yml @@ -57,6 +57,7 @@ website_mail_recipients: user wsgi_application: testapp:application wsgi_requirements: [] + python_version: 3 - role: wsgi_website fqdn: parameters-paste-req diff --git a/roles/wsgi_website/molecule/default/tests/data/python/paste/testapp.py b/roles/wsgi_website/molecule/default/tests/data/python/paste/testapp.py index 155506151fd3f73518ab4208339128fa2a767132..50396bb6534f6090cf1b2ff58225cf9733cdfa35 100644 --- a/roles/wsgi_website/molecule/default/tests/data/python/paste/testapp.py +++ b/roles/wsgi_website/molecule/default/tests/data/python/paste/testapp.py @@ -1,4 +1,6 @@ import os +import sys + import flask from flask import Flask @@ -20,6 +22,7 @@ def index(path):
Requested URL was: {scheme}://{host}{script}{path}
MY_ENV_VAR: {my_env_var}
Accept-Encoding: {accept_encoding}
+Python version: {python_version}