python
: Installs and manages python, python-dev and gunicorn.python::pip::bootstrap
: allow to bootstrap pip when python is managed from other module
python::config
: Optionally installs the gunicorn servicepython::install
: Installs core python packagespython::params
: The python Module default configuration settings.
python::dotfile
: Manages any python dotfiles with a simple config hash.python::gunicorn
: Manages Gunicorn virtual hosts.python::pip
: Installs and manages packages from pip.python::pyvenv
: Create a Python3 virtualenv using pyvenv.python::requirements
: Installs and manages Python packages from requirements file.
Python::Loglevel
: Match all valid loglevels for pythonPython::Package::Ensure
: Match all valid package ensures for pythonPython::Provider
: Match all valid provider for pythonPython::Umask
: Match valid umask for pythonPython::Venv::PipVersion
: A version type to ensure a specific Pip version in a virtual env.Python::Version
: Match all valid versions for python
Installs and manages python, python-dev and gunicorn.
class { 'python':
version => 'system',
pip => 'present',
dev => 'present',
gunicorn => 'present',
}
class { 'python' :
ensure => 'present',
version => 'rh-python36-python',
dev => 'present',
}
The following parameters are available in the python
class:
ensure
version
pip
dev
gunicorn
manage_gunicorn
provider
use_epel
manage_scl
umask
manage_gunicorn
manage_python_package
manage_dev_package
manage_venv_package
manage_pip_package
venv
gunicorn_package_name
python_pips
python_pyvenvs
python_requirements
python_dotfiles
rhscl_use_public_repository
anaconda_installer_url
anaconda_install_path
Data type: Python::Package::Ensure
Desired installation state for the Python package.
Default value: 'present'
Data type: Python::Version
Python version to install. Beware that valid values for this differ a) by the provider you choose and b) by the osfamily/operatingsystem you are using. Allowed values:
- provider == pip: everything pip allows as a version after the 'python=='
- else: 'system', 'pypy', 3/3.3/...
- Be aware that 'system' usually means python 2.X.
- 'pypy' actually lets us use pypy as python.
- 3/3.3/... means you are going to install the python3/python3.3/... package, if available on your osfamily.
Default value: $facts['os']['family'] ? { 'Archlinux' => 'system', default => '3'
Data type: Python::Package::Ensure
Desired installation state for the python-pip package.
Default value: 'present'
Data type: Python::Package::Ensure
Desired installation state for the python-dev package.
Default value: 'absent'
Data type: Python::Package::Ensure
Desired installation state for Gunicorn.
Default value: 'absent'
Data type: Boolean
Allow Installation / Removal of Gunicorn.
Default value: true
Data type: Optional[Python::Provider]
What provider to use for installation of the packages, except gunicorn and Python itself.
Default value: undef
Data type: Boolean
to determine if the epel class is used.
Default value: $python::params::use_epel
Data type: Boolean
Whether to manage core SCL packages or not.
Default value: true
Data type: Optional[Python::Umask]
The default umask for invoked exec calls.
Default value: undef
manage the state for package gunicorn
Default value: true
Data type: Boolean
manage the state for package python
Default value: true
Data type: Boolean
manage the state of the python development package
Default value: true
Data type: Boolean
manage the state for package venv
Default value: $python::params::manage_venv_package
Data type: Boolean
manage the state for package pip
Default value: $python::params::manage_pip_package
Data type: Python::Package::Ensure
Default value: 'absent'
Data type: String[1]
Default value: $python::params::gunicorn_package_name
Data type: Hash
Default value: {}
Data type: Hash
Default value: {}
Data type: Hash
Default value: {}
Data type: Hash
Default value: {}
Data type: Boolean
Default value: true
Data type: Stdlib::Httpurl
Default value: 'https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh'
Data type: Stdlib::Absolutepath
Default value: '/opt/python'
allow to bootstrap pip when python is managed from other module
class { 'python::pip::bootstrap':
version => 'pip',
}
The following parameters are available in the python::pip::bootstrap
class:
Data type: Enum['pip', 'pip3']
should be pip or pip3
Default value: 'pip'
Data type: Variant[Boolean, String]
if python module will manage deps
Default value: false
Data type: Optional[Stdlib::HTTPUrl]
Proxy server to use for outbound connections.
Default value: undef
Data type: String[1]
Default value: 'shell'
Manages any python dotfiles with a simple config hash.
python::dotfile { '/var/lib/jenkins/.pip/pip.conf':
ensure => present,
owner => 'jenkins',
group => 'jenkins',
config => {
'global' => {
'index-url' => 'https://mypypi.acme.com/simple/'
'extra-index-url' => 'https://pypi.risedev.at/simple/'
}
}
}
The following parameters are available in the python::dotfile
defined type:
Data type: Enum['absent', 'present']
Default value: 'present'
Data type: Stdlib::Absolutepath
Filename.
Default value: $title
Data type: Stdlib::Filemode
File mode.
Default value: '0644'
Data type: String[1]
user owner of dotfile
Default value: 'root'
Data type: String[1]
group owner of dotfile
Default value: 'root'
Data type: Hash
Config hash. This will be expanded to an ini-file.
Default value: {}
Manages Gunicorn virtual hosts.
python::gunicorn { 'vhost':
ensure => present,
virtualenv => '/var/www/project1',
mode => 'wsgi',
dir => '/var/www/project1/current',
bind => 'unix:/tmp/gunicorn.socket',
environment => 'prod',
owner => 'www-data',
group => 'www-data',
appmodule => 'app:app',
osenv => { 'DBHOST' => 'dbserver.example.com' },
timeout => 30,
template => 'python/gunicorn.erb',
}
The following parameters are available in the python::gunicorn
defined type:
ensure
config_dir
manage_config_dir
virtualenv
mode
dir
bind
environment
appmodule
osenv
timeout
template
args
owner
group
workers
access_log_format
accesslog
errorlog
log_level
Data type: Enum['present', 'absent']
Default value: present
Data type: Stdlib::Absolutepath
Configure the gunicorn config directory path.
Default value: '/etc/gunicorn.d'
Data type: Boolean
Set if the gunicorn config directory should be created.
Default value: false
Data type: Variant[Boolean,Stdlib::Absolutepath]
Run in virtualenv, specify directory.
Default value: false
Data type: Enum['wsgi', 'django']
Gunicorn mode.
Default value: 'wsgi'
Data type: Stdlib::Absolutepath
Application directory.
Data type: Variant[String[1],Boolean]
Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. Default: system-wide: unix:/tmp/gunicorn-$name.socket virtualenv: unix:${virtualenv}/${name}.socket
Default value: false
Data type: Variant[String[1],Boolean]
Set ENVIRONMENT variable.
Default value: false
Data type: String[1]
Set the application module name for gunicorn to load when not using Django.
Default value: 'app:app'
Data type: Variant[Boolean,Hash]
Allows setting environment variables for the gunicorn service. Accepts a hash of 'key': 'value' pairs.
Default value: false
Data type: Integer
Allows setting the gunicorn idle worker process time before being killed. The unit of time is seconds.
Default value: 30
Data type: String[1]
Which ERB template to use.
Default value: 'python/gunicorn.erb'
Data type: Array
Custom arguments to add in gunicorn config file.
Default value: []
Data type: String[1]
Default value: 'www-data'
Data type: String[1]
Default value: 'www-data'
Data type: Variant[Boolean,Integer]
Default value: false
Data type: Variant[Boolean,String[1]]
Default value: false
Data type: Variant[Boolean,Stdlib::Absolutepath]
Default value: false
Data type: Variant[Boolean,Stdlib::Absolutepath]
Default value: false
Data type: Python::Loglevel
Default value: 'error'
Installs and manages packages from pip.
python::pip { 'flask':
virtualenv => '/var/www/project1',
proxy => 'http://proxy.domain.com:3128',
index => 'http://www.example.com/simple/',
}
python::pip { 'cx_Oracle' :
pkgname => 'cx_Oracle',
ensure => '5.1.2',
virtualenv => '/var/www/project1',
owner => 'appuser',
proxy => 'http://proxy.domain.com:3128',
environment => ['ORACLE_HOME=/usr/lib/oracle/11.2/client64'],
install_args => '-e',
timeout => 1800,
}
python::pip { 'requests' :
ensure => 'present',
pkgname => 'requests',
pip_provider => 'pip3',
virtualenv => '/var/www/project1',
owner => 'root',
timeout => 1800
}
The following parameters are available in the python::pip
defined type:
name
pkgname
ensure
virtualenv
pip_provider
url
owner
group
index
extra_index
proxy
editable
environment
extras
timeout
install_args
uninstall_args
log_dir
egg
umask
path
exec_provider
must be unique
Data type: String[1]
the name of the package.
Default value: $name
Data type: Variant[Enum[present, absent, latest], String[1]]
Require pip to be available.
Default value: present
Data type: Variant[Enum['system'], Stdlib::Absolutepath]
virtualenv to run pip in.
Default value: 'system'
Data type: String[1]
version of pip you wish to use.
Default value: 'pip'
Data type: Variant[Boolean, String]
URL to install from.
Default value: false
Data type: String[1]
The owner of the virtualenv being manipulated.
Default value: 'root'
Data type: Optional[String[1]]
The group of the virtualenv being manipulated.
Default value: getvar('python::params::group')
Data type: Variant[Boolean,String[1]]
Base URL of Python package index.
Default value: false
Data type: Variant[Boolean,String[1]]
Base URL of extra Python package index.
Default value: false
Data type: Optional[Stdlib::HTTPUrl]
Proxy server to use for outbound connections.
Default value: undef
Data type: Boolean
If true the package is installed as an editable resource.
Default value: false
Data type: Array
Additional environment variables required to install the packages.
Default value: []
Data type: Array
Extra features provided by the package which should be installed.
Default value: []
Data type: Numeric
The maximum time in seconds the "pip install" command should take.
Default value: 1800
Data type: Optional[String[1]]
Any additional installation arguments that will be supplied when running pip install.
Default value: undef
Data type: Optional[String[1]]
Any additional arguments that will be supplied when running pip uninstall.
Default value: undef
Data type: String[1]
Log directory
Default value: '/tmp'
Data type: Any
The egg name to use
Default value: false
Data type: Optional[Python::Umask]
Default value: undef
Data type: Array[String]
Default value: ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin']
Data type: String[1]
Default value: 'shell'
Create a Python3 virtualenv using pyvenv.
python::pyvenv { '/var/www/project1' :
ensure => present,
version => 'system',
systempkgs => true,
venv_dir => '/home/appuser/virtualenvs',
owner => 'appuser',
group => 'apps',
}
The following parameters are available in the python::pyvenv
defined type:
Data type: Python::Package::Ensure
Default value: present
Data type: Python::Version
Python version to use.
Default value: 'system'
Data type: Boolean
Copy system site-packages into virtualenv
Default value: false
Data type: Stdlib::Absolutepath
Directory to install virtualenv to
Default value: $name
Data type: String[1]
The owner of the virtualenv being manipulated
Default value: 'root'
Data type: String[1]
The group relating to the virtualenv being manipulated
Default value: 'root'
Data type: Stdlib::Filemode
Optionally specify directory mode
Default value: '0755'
Data type: Array[Stdlib::Absolutepath]
Specifies the PATH variable.
Default value: ['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',]
Data type: Array
Optionally specify environment variables for pyvenv
Default value: []
Data type: Optional[String[1]]
Optionally specify the virtualenv prompt (python >= 3.6)
Default value: undef
Data type: Optional[Stdlib::Absolutepath]
Optionally specify python path for creation of virtualenv
Default value: undef
Data type: Python::Venv::PipVersion
Default value: 'latest'
Installs and manages Python packages from requirements file.
python::requirements { '/var/www/project1/requirements.txt' :
virtualenv => '/var/www/project1',
proxy => 'http://proxy.domain.com:3128',
owner => 'appuser',
group => 'apps',
}
The following parameters are available in the python::requirements
defined type:
requirements
virtualenv
pip_provider
owner
group
proxy
src
environment
forceupdate
cwd
extra_pip_args
manage_requirements
fix_requirements_owner
log_dir
timeout
Data type: Stdlib::Absolutepath
Path to the requirements file.
Default value: $name
Data type: Variant[Enum['system'],Stdlib::Absolutepath]
virtualenv to run pip in.
Default value: 'system'
Data type: Enum['pip', 'pip3']
version of pip you wish to use.
Default value: 'pip'
Data type: String[1]
The owner of the virtualenv being manipulated.
Default value: 'root'
Data type: String[1]
The group relating to the virtualenv being manipulated.
Default value: 'root'
Data type: Optional[Stdlib::HTTPUrl]
Proxy server to use for outbound connections.
Default value: undef
Data type: Any
Pip --src parameter to; if the requirements file contains --editable resources, this parameter specifies where they will be installed. See the pip documentation for more.
Default value: false
Data type: Array
Additional environment variables required to install the packages.
Default value: []
Data type: Boolean
Run a pip install requirements even if we don't receive an event from the requirements file - Useful for when the requirements file is written as part of a resource other than file (E.g vcsrepo)
Default value: false
Data type: Optional[Stdlib::Absolutepath]
The directory from which to run the "pip install" command.
Default value: undef
Data type: Optional[String[1]]
Extra arguments to pass to pip after the requirements file
Default value: undef
Data type: Boolean
Create the requirements file if it doesn't exist.
Default value: true
Data type: Boolean
Change owner and group of requirements file.
Default value: true
Data type: Stdlib::Absolutepath
Log directory.
Default value: '/tmp'
Data type: Integer
The maximum time in seconds the "pip install" command should take.
Default value: 1800
Match all valid loglevels for python
Alias of Enum['debug', 'info', 'warning', 'error', 'critical']
Match all valid package ensures for python
Alias of Enum['absent', 'present', 'installed', 'latest']
Match all valid provider for python
Alias of Enum['pip', 'scl', 'rhscl', 'anaconda', '']
Match valid umask for python
Alias of Pattern[/[0-7]{1,4}/]
A version type to ensure a specific Pip version in a virtual env.
Alias of Pattern[/^(<|>|<=|>=|==) [0-9]*(\.[0-9]+)*$/, /\Alatest\Z/]
Match all valid versions for python
Alias of Pattern[/\A(python)?[0-9](\.?[0-9])*/, /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/]