From 85288628971acfc386fbc7d4f38eae7a1e4e939c Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 22 Oct 2018 00:30:05 -0400 Subject: [PATCH] fixed puppet strings for remaing files --- REFERENCE.md | 530 ++++++++++++++------------------------ manifests/config.pp | 15 +- manifests/dotfile.pp | 45 ++-- manifests/gunicorn.pp | 95 +++---- manifests/init.pp | 73 ++---- manifests/install.pp | 15 +- manifests/params.pp | 3 +- manifests/pyvenv.pp | 61 ++--- manifests/requirements.pp | 90 ++----- manifests/virtualenv.pp | 105 +++----- 10 files changed, 330 insertions(+), 702 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index b5fd1b6e..b16b5302 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -5,25 +5,39 @@ **Classes** -* [`python`](#python): -* [`python::config`](#pythonconfig): -* [`python::install`](#pythoninstall): == Class: python::install Installs core python packages, === Examples include python::install === Authors Sergey Stankevich Ashley Penne -* [`python::params`](#pythonparams): == Class: python::params The python Module default configuration settings. +* [`python`](#python): Installs and manages python, python-dev, python-virtualenv and gunicorn. +* [`python::config`](#pythonconfig): Optionally installs the gunicorn service +* [`python::install`](#pythoninstall): Installs core python packages +* [`python::params`](#pythonparams): The python Module default configuration settings. **Defined types** -* [`python::dotfile`](#pythondotfile): == Define: python::dotfile Manages any python dotfiles with a simple config hash. === Parameters [*ensure*] present|absent. Default: pres -* [`python::gunicorn`](#pythongunicorn): == Define: python::gunicorn Manages Gunicorn virtual hosts. === Parameters [*ensure*] present|absent. Default: present [*config_dir*] C +* [`python::dotfile`](#pythondotfile): Manages any python dotfiles with a simple config hash. +* [`python::gunicorn`](#pythongunicorn): Manages Gunicorn virtual hosts. * [`python::pip`](#pythonpip): Installs and manages packages from pip. -* [`python::pyvenv`](#pythonpyvenv): [*environment*] Optionally specify environment variables for pyvenv === Examples python::venv { '/var/www/project1': ensure => pres -* [`python::requirements`](#pythonrequirements): == Define: python::requirements Installs and manages Python packages from requirements file. === Parameters [*requirements*] Path to the -* [`python::virtualenv`](#pythonvirtualenv): == Define: python::virtualenv Creates Python virtualenv. === Parameters [*ensure*] present|absent. Default: present [*version*] Python +* [`python::pyvenv`](#pythonpyvenv): +* [`python::requirements`](#pythonrequirements): Installs and manages Python packages from requirements file. +* [`python::virtualenv`](#pythonvirtualenv): Creates Python virtualenv. ## Classes ### python -The python class. +Installs and manages python, python-dev, python-virtualenv and gunicorn. + +#### Examples + +##### ensure system python is installed, with pip,dev, virtualenv, and gunicorn packages present + +```puppet +class { 'python': + version => 'system', + pip => 'present', + dev => 'present', + virtualenv => 'present', + gunicorn => 'present', +} +``` #### Parameters @@ -33,7 +47,8 @@ The following parameters are available in the `python` class. Data type: `Enum['absent', 'present', 'latest']` - +Desired installation state for the Python package. +Allowed values: absent, present and latest Default value: $python::params::ensure @@ -41,7 +56,14 @@ Default value: $python::params::ensure Data type: `Any` - +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: $python::params::version @@ -49,7 +71,8 @@ Default value: $python::params::version Data type: `Enum['absent', 'present', 'latest']` - +Desired installation state for python-pip. Boolean values are deprecated. +Allowed values: 'absent', 'present', 'latest' Default value: $python::params::pip @@ -57,7 +80,8 @@ Default value: $python::params::pip Data type: `Any` - +Desired installation state for python-dev. Boolean values are deprecated. +Allowed values: 'absent', 'present', 'latest' Default value: $python::params::dev @@ -65,7 +89,8 @@ Default value: $python::params::dev Data type: `Enum['absent', 'present', 'latest']` - +Desired installation state for python-virtualenv. Boolean values are deprecated +Allowed values: 'absent', 'present', 'latest Default value: $python::params::virtualenv @@ -73,7 +98,8 @@ Default value: $python::params::virtualenv Data type: `Enum['absent', 'present', 'latest']` - +Desired installation state for Gunicorn. Boolean values are deprecated. +Allowed values: 'absent', 'present', 'latest' Default value: $python::params::gunicorn @@ -81,25 +107,34 @@ Default value: $python::params::gunicorn Data type: `Boolean` - +Allow Installation / Removal of Gunicorn. Default: true Default value: $python::params::manage_gunicorn -##### `gunicorn_package_name` +##### `provider` -Data type: `Any` +Data type: `Optional[Enum['pip', 'scl', 'rhscl', 'anaconda', '']]` +What provider to use for installation of the packages, except gunicorn and Python itself. +Allowed values: 'pip' +Default value: $python::params::provider -Default value: $python::params::gunicorn_package_name +##### `use_epel` -##### `provider` +Data type: `Boolean` -Data type: `Optional[Enum['pip', 'scl', 'rhscl', 'anaconda', '']]` +to determine if the epel class is used. + +Default value: $python::params::use_epel +##### `gunicorn_package_name` +Data type: `Any` -Default value: $python::params::provider + + +Default value: $python::params::gunicorn_package_name ##### `valid_versions` @@ -149,14 +184,6 @@ Data type: `Hash` Default value: { } -##### `use_epel` - -Data type: `Boolean` - - - -Default value: $python::params::use_epel - ##### `rhscl_use_public_repository` Data type: `Any` @@ -183,28 +210,29 @@ Default value: $python::params::anaconda_install_path ### python::config -The python::config class. +Optionally installs the gunicorn service -### python::install +#### Examples -== Class: python::install +##### -Installs core python packages, +```puppet +include python::config +``` -=== Examples +### python::install -include python::install +Installs core python packages -=== Authors +#### Examples -Sergey Stankevich -Ashley Penney -Fotis Gimian -Garrett Honeycutt +##### -### python::params +```puppet +include python::install +``` -== Class: python::params +### python::params The python Module default configuration settings. @@ -212,30 +240,13 @@ The python Module default configuration settings. ### python::dotfile -== Define: python::dotfile - -Manages any python dotfiles with a simple config hash. - -=== Parameters - -[*ensure*] - present|absent. Default: present - -[*filename*] - Filename. Default: $title - -[*mode*] - File mode. Default: 0644 - -[*owner*] -[*group*] - Owner/group. Default: `root`/`root` +=== Examples -[*config*] - Config hash. This will be expanded to an ini-file. Default: {} +#### Examples -=== Examples +##### Create a pip config in /var/lib/jenkins/.pip/ +```puppet python::dotfile { '/var/lib/jenkins/.pip/pip.conf': ensure => present, owner => 'jenkins', @@ -247,6 +258,7 @@ python::dotfile { '/var/lib/jenkins/.pip/pip.conf': } } } +``` #### Parameters @@ -256,7 +268,7 @@ The following parameters are available in the `python::dotfile` defined type. Data type: `Any` - +present|absent. Default: present Default value: 'present' @@ -264,99 +276,51 @@ Default value: 'present' Data type: `Any` - +Filename. Default: $title Default value: $title -##### `owner` +##### `mode` Data type: `Any` +File mode. Default: 0644 +Default value: '0644' -Default value: 'root' - -##### `group` +##### `owner` Data type: `Any` - +user owner of dotfile Default value: 'root' -##### `mode` +##### `group` Data type: `Any` +group owner of dotfile - -Default value: '0644' +Default value: 'root' ##### `config` Data type: `Any` - +Config hash. This will be expanded to an ini-file. Default: {} Default value: {} ### python::gunicorn -== Define: python::gunicorn - Manages Gunicorn virtual hosts. -=== Parameters - -[*ensure*] - present|absent. Default: present - -[*config_dir*] - Configure the gunicorn config directory path. Default: /etc/gunicorn.d - -[*manage_config_dir*] - Set if the gunicorn config directory should be created. Default: false - -[*virtualenv*] - Run in virtualenv, specify directory. Default: disabled - -[*mode*] - Gunicorn mode. - wsgi|django. Default: wsgi - -[*dir*] - Application directory. - -[*bind*] - Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. - Default: system-wide: unix:/tmp/gunicorn-$name.socket - virtualenv: unix:${virtualenv}/${name}.socket - -[*environment*] - Set ENVIRONMENT variable. Default: none - -[*appmodule*] - Set the application module name for gunicorn to load when not using Django. - Default: app:app - -[*osenv*] - Allows setting environment variables for the gunicorn service. Accepts a - hash of 'key': 'value' pairs. - Default: false - -[*timeout*] - Allows setting the gunicorn idle worker process time before being killed. - The unit of time is seconds. - Default: 30 - -[*template*] - Which ERB template to use. Default: python/gunicorn.erb - -[*args*] - Custom arguments to add in gunicorn config file. Default: [] +#### Examples -=== Examples +##### run gunicorn on vhost in virtualenv /var/www/project1 +```puppet python::gunicorn { 'vhost': ensure => present, virtualenv => '/var/www/project1', @@ -371,12 +335,7 @@ python::gunicorn { 'vhost': timeout => 30, template => 'python/gunicorn.erb', } - -=== Authors - -Sergey Stankevich -Ashley Penney -Marc Fournier +``` #### Parameters @@ -394,7 +353,7 @@ Default value: present Data type: `Any` - +Configure the gunicorn config directory path. Default: /etc/gunicorn.d Default value: '/etc/gunicorn.d' @@ -402,7 +361,7 @@ Default value: '/etc/gunicorn.d' Data type: `Any` - +Set if the gunicorn config directory should be created. Default: false Default value: `false` @@ -410,7 +369,7 @@ Default value: `false` Data type: `Any` - +Run in virtualenv, specify directory. Default: disabled Default value: `false` @@ -418,7 +377,8 @@ Default value: `false` Data type: `Any` - +Gunicorn mode. +wsgi|django. Default: wsgi Default value: 'wsgi' @@ -426,7 +386,7 @@ Default value: 'wsgi' Data type: `Any` - +Application directory. Default value: `false` @@ -434,7 +394,9 @@ Default value: `false` Data type: `Any` - +Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. +Default: system-wide: unix:/tmp/gunicorn-$name.socket + virtualenv: unix:${virtualenv}/${name}.socket Default value: `false` @@ -442,67 +404,72 @@ Default value: `false` Data type: `Any` - +Set ENVIRONMENT variable. Default: none Default value: `false` -##### `owner` +##### `appmodule` Data type: `Any` +Set the application module name for gunicorn to load when not using Django. +Default: app:app +Default value: 'app:app' -Default value: 'www-data' - -##### `group` +##### `osenv` Data type: `Any` +Allows setting environment variables for the gunicorn service. Accepts a +hash of 'key': 'value' pairs. +Default: false +Default value: `false` -Default value: 'www-data' - -##### `appmodule` +##### `timeout` Data type: `Any` +Allows setting the gunicorn idle worker process time before being killed. +The unit of time is seconds. +Default: 30 +Default value: 30 -Default value: 'app:app' - -##### `osenv` +##### `template` Data type: `Any` +Which ERB template to use. Default: python/gunicorn.erb +Default value: 'python/gunicorn.erb' -Default value: `false` - -##### `timeout` +##### `args` Data type: `Any` +Custom arguments to add in gunicorn config file. Default: [] +Default value: [] -Default value: 30 - -##### `workers` +##### `owner` Data type: `Any` -Default value: `false` +Default value: 'www-data' -##### `access_log_format` +##### `group` Data type: `Any` -Default value: `false` +Default value: 'www-data' -##### `accesslog` +##### `workers` Data type: `Any` @@ -510,7 +477,7 @@ Data type: `Any` Default value: `false` -##### `errorlog` +##### `access_log_format` Data type: `Any` @@ -518,29 +485,29 @@ Data type: `Any` Default value: `false` -##### `log_level` +##### `accesslog` Data type: `Any` -Default value: 'error' +Default value: `false` -##### `template` +##### `errorlog` Data type: `Any` -Default value: 'python/gunicorn.erb' +Default value: `false` -##### `args` +##### `log_level` Data type: `Any` -Default value: [] +Default value: 'error' ### python::pip @@ -726,24 +693,19 @@ Default value: ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'] ### python::pyvenv -[*environment*] -Optionally specify environment variables for pyvenv +The python::pyvenv class. -=== Examples +#### Examples + +##### +```puppet python::venv { '/var/www/project1': ensure => present, version => 'system', systempkgs => true, } - -=== Authors - -Sergey Stankevich -Ashley Penney -Marc Fournier -Fotis Gimian -Seth Cleveland +``` #### Parameters @@ -761,7 +723,7 @@ Default value: present Data type: `Any` - +Python version to use. Default: system default Default value: 'system' @@ -769,7 +731,7 @@ Default value: 'system' Data type: `Any` - +Copy system site-packages into virtualenv Default value: `false` @@ -777,7 +739,7 @@ Default value: `false` Data type: `Any` - +Directory to install virtualenv to Default value: $name @@ -785,7 +747,7 @@ Default value: $name Data type: `Any` - +The owner of the virtualenv being manipulated Default value: 'root' @@ -793,7 +755,7 @@ Default value: 'root' Data type: `Any` - +The group relating to the virtualenv being manipulated Default value: 'root' @@ -801,7 +763,7 @@ Default value: 'root' Data type: `Any` - +Optionally specify directory mode Default value: '0755' @@ -809,7 +771,7 @@ Default value: '0755' Data type: `Any` - +Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] Default value: [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ] @@ -817,80 +779,24 @@ Default value: [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ] Data type: `Any` - +Optionally specify environment variables for pyvenv Default value: [] ### python::requirements -== Define: python::requirements - Installs and manages Python packages from requirements file. -=== Parameters - -[*requirements*] - Path to the requirements file. Defaults to the resource name - -[*virtualenv*] - virtualenv to run pip in. Default: system-wide - -[*pip_provider*] - version of pip you wish to use. Default: pip - -[*owner*] - The owner of the virtualenv being manipulated. Default: root - -[*group*] - The group relating to the virtualenv being manipulated. Default: root - -[*proxy*] - Proxy server to use for outbound connections. Default: none - -[*src*] -Pip --src parameter; if the requirements file contains --editable resources, -this parameter specifies where they will be installed. See the pip -documentation for more. Default: none (i.e. use the pip default). - -[*environment*] - Additional environment variables required to install the packages. Default: none - -[*forceupdate*] - 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) - -[*cwd*] - The directory from which to run the "pip install" command. Default: undef - -[*extra_pip_args*] -Extra arguments to pass to pip after the requirements file - -[*manage_requirements*] -Create the requirements file if it doesn't exist. Default: true - -[*fix_requirements_owner*] -Change owner and group of requirements file. Default: true - -[*log_dir*] -String. Log directory. - -[*timeout*] - The maximum time in seconds the "pip install" command should take. Default: 1800 +#### Examples -=== Examples +##### install pip requirements from /var/www/project1/requirements.txt +```puppet python::requirements { '/var/www/project1/requirements.txt': virtualenv => '/var/www/project1', proxy => 'http://proxy.domain.com:3128', } - -=== Authors - -Sergey Stankevich -Ashley Penney -Fotis Gimian -Daniel Quackenbush +``` #### Parameters @@ -900,7 +806,7 @@ The following parameters are available in the `python::requirements` defined typ Data type: `Any` - +Path to the requirements file. Defaults to the resource name Default value: $name @@ -908,7 +814,7 @@ Default value: $name Data type: `Any` - +virtualenv to run pip in. Default: system-wide Default value: 'system' @@ -916,7 +822,7 @@ Default value: 'system' Data type: `Enum['pip', 'pip3']` - +version of pip you wish to use. Default: pip Default value: 'pip' @@ -924,7 +830,7 @@ Default value: 'pip' Data type: `Any` - +The owner of the virtualenv being manipulated. Default value: 'root' @@ -932,7 +838,7 @@ Default value: 'root' Data type: `Any` - +The group relating to the virtualenv being manipulated. Default value: 'root' @@ -940,7 +846,7 @@ Default value: 'root' Data type: `Any` - +Proxy server to use for outbound connections. Default value: `false` @@ -948,7 +854,7 @@ Default value: `false` Data type: `Any` - +Pip --src parameter; if the requirements file contains --editable resources, this parameter specifies where they will be installed. See the pip documentation for more. Default value: `false` @@ -956,7 +862,7 @@ Default value: `false` Data type: `Any` - +Additional environment variables required to install the packages. Default value: [] @@ -964,7 +870,7 @@ Default value: [] Data type: `Any` - +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` @@ -972,7 +878,7 @@ Default value: `false` Data type: `Any` - +The directory from which to run the "pip install" command. Default value: `undef` @@ -980,7 +886,7 @@ Default value: `undef` Data type: `Any` - +Extra arguments to pass to pip after the requirements file Default value: '' @@ -988,7 +894,7 @@ Default value: '' Data type: `Any` - +Create the requirements file if it doesn't exist. Default value: `true` @@ -996,7 +902,7 @@ Default value: `true` Data type: `Any` - +Change owner and group of requirements file. Default value: `true` @@ -1004,7 +910,7 @@ Default value: `true` Data type: `Any` - +Log directory. Default value: '/tmp' @@ -1012,75 +918,19 @@ Default value: '/tmp' Data type: `Any` - +The maximum time in seconds the "pip install" command should take. Default value: 1800 ### python::virtualenv -== Define: python::virtualenv - Creates Python virtualenv. -=== Parameters - -[*ensure*] - present|absent. Default: present - -[*version*] - Python version to use. Default: system default - -[*requirements*] - Path to pip requirements.txt file. Default: none - -[*systempkgs*] - Copy system site-packages into virtualenv. Default: don't - If virtualenv version < 1.7 this flag has no effect since - -[*venv_dir*] - Directory to install virtualenv to. Default: $name - -[*ensure_venv_dir*] -Create $venv_dir. Default: true - -[*distribute*] - Include distribute in the virtualenv. Default: true - -[*index*] - Base URL of Python package index. Default: none (http://pypi.python.org/simple/) - -[*owner*] - The owner of the virtualenv being manipulated. Default: root - -[*group*] - The group relating to the virtualenv being manipulated. Default: root - -[*mode*] -Optionally specify directory mode. Default: 0755 - -[*proxy*] - Proxy server to use for outbound connections. Default: none - -[*environment*] - Additional environment variables required to install the packages. Default: none - -[*path*] - Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] - -[*cwd*] - The directory from which to run the "pip install" command. Default: undef - -[*timeout*] - The maximum time in seconds the "pip install" command should take. Default: 1800 - -[*pip_args*] - Arguments to pass to pip during initialization. Default: blank - -[*extra_pip_args*] - Extra arguments to pass to pip after requirements file. Default: blank +#### Examples -=== Examples +##### install a virtual env at /var/www/project1 +```puppet python::virtualenv { '/var/www/project1': ensure => present, version => 'system', @@ -1089,11 +939,7 @@ python::virtualenv { '/var/www/project1': systempkgs => true, index => 'http://www.example.com/simple/', } - -=== Authors - -Sergey Stankevich -Shiva Poudel +``` #### Parameters @@ -1111,7 +957,7 @@ Default value: present Data type: `Any` - +Python version to use. Default value: 'system' @@ -1119,7 +965,7 @@ Default value: 'system' Data type: `Any` - +Path to pip requirements.txt file Default value: `false` @@ -1127,7 +973,7 @@ Default value: `false` Data type: `Any` - +Copy system site-packages into virtualenv. Default: don't If virtualenv version < 1.7 this flag has no effect since Default value: `false` @@ -1135,7 +981,7 @@ Default value: `false` Data type: `Any` - +Directory to install virtualenv to Default value: $name @@ -1143,7 +989,7 @@ Default value: $name Data type: `Any` - +reate $venv_dir Default value: `true` @@ -1151,7 +997,7 @@ Default value: `true` Data type: `Any` - +Include distribute in the virtualenv Default value: `true` @@ -1159,7 +1005,7 @@ Default value: `true` Data type: `Any` - +Base URL of Python package index Default value: `false` @@ -1167,7 +1013,7 @@ Default value: `false` Data type: `Any` - +The owner of the virtualenv being manipulated Default value: 'root' @@ -1175,7 +1021,7 @@ Default value: 'root' Data type: `Any` - +The group relating to the virtualenv being manipulated Default value: 'root' @@ -1183,7 +1029,7 @@ Default value: 'root' Data type: `Any` - +Optionally specify directory mode Default value: '0755' @@ -1191,7 +1037,7 @@ Default value: '0755' Data type: `Any` - +Proxy server to use for outbound connections Default value: `false` @@ -1199,7 +1045,7 @@ Default value: `false` Data type: `Any` - +Additional environment variables required to install the packages Default value: [] @@ -1207,7 +1053,7 @@ Default value: [] Data type: `Any` - +Specifies the PATH variable Default value: [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ] @@ -1215,7 +1061,7 @@ Default value: [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ] Data type: `Any` - +The directory from which to run the "pip install" command Default value: `undef` @@ -1223,7 +1069,7 @@ Default value: `undef` Data type: `Any` - +The maximum time in seconds the "pip install" command should take Default value: 1800 @@ -1231,7 +1077,7 @@ Default value: 1800 Data type: `Any` - +Arguments to pass to pip during initialization Default value: '' @@ -1239,7 +1085,7 @@ Default value: '' Data type: `Any` - +Extra arguments to pass to pip after requirements file Default value: '' diff --git a/manifests/config.pp b/manifests/config.pp index 78a424b9..9788838d 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,18 +1,9 @@ -# == Define: python::config # -# Optionally installs the gunicorn service +# @summary Optionally installs the gunicorn service # -# === Examples +# @example +# include python::config # -# include python::config -# -# === Authors -# -# Sergey Stankevich -# Ashley Penney -# Fotis Gimian -# - class python::config { Class['python::install'] -> Python::Pip <| |> diff --git a/manifests/dotfile.pp b/manifests/dotfile.pp index 5bc70ae9..de1bd096 100644 --- a/manifests/dotfile.pp +++ b/manifests/dotfile.pp @@ -1,38 +1,27 @@ -# == Define: python::dotfile # -# Manages any python dotfiles with a simple config hash. +# @summary Manages any python dotfiles with a simple config hash. # -# === Parameters -# -# [*ensure*] -# present|absent. Default: present -# -# [*filename*] -# Filename. Default: $title -# -# [*mode*] -# File mode. Default: 0644 -# -# [*owner*] -# [*group*] -# Owner/group. Default: `root`/`root` -# -# [*config*] -# Config hash. This will be expanded to an ini-file. Default: {} +# @param ensure present|absent. Default: present +# @param filename Filename. Default: $title +# @param mode File mode. Default: 0644 +# @param owner user owner of dotfile +# @param group group owner of dotfile +# @param config Config hash. This will be expanded to an ini-file. Default: {} # # === Examples # -# 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/ +# @example Create a pip config in /var/lib/jenkins/.pip/ +# 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/ +# } # } # } -# } # # define python::dotfile ( diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index bc996e6e..74e3251a 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -1,78 +1,43 @@ -# == Define: python::gunicorn # -# Manages Gunicorn virtual hosts. +# @summary Manages Gunicorn virtual hosts. # -# === Parameters -# -# [*ensure*] -# present|absent. Default: present -# -# [*config_dir*] -# Configure the gunicorn config directory path. Default: /etc/gunicorn.d -# -# [*manage_config_dir*] -# Set if the gunicorn config directory should be created. Default: false -# -# [*virtualenv*] -# Run in virtualenv, specify directory. Default: disabled -# -# [*mode*] -# Gunicorn mode. +# @param ensure +# @param config_dir Configure the gunicorn config directory path. Default: /etc/gunicorn.d +# @param manage_config_dir Set if the gunicorn config directory should be created. Default: false +# @param virtualenv Run in virtualenv, specify directory. Default: disabled +# @param mode Gunicorn mode. # wsgi|django. Default: wsgi -# -# [*dir*] -# Application directory. -# -# [*bind*] -# Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. +# @param dir Application directory. +# @param bind Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. # Default: system-wide: unix:/tmp/gunicorn-$name.socket # virtualenv: unix:${virtualenv}/${name}.socket -# -# [*environment*] -# Set ENVIRONMENT variable. Default: none -# -# [*appmodule*] -# Set the application module name for gunicorn to load when not using Django. +# @param environment Set ENVIRONMENT variable. Default: none +# @param appmodule Set the application module name for gunicorn to load when not using Django. # Default: app:app -# -# [*osenv*] -# Allows setting environment variables for the gunicorn service. Accepts a +# @param osenv Allows setting environment variables for the gunicorn service. Accepts a # hash of 'key': 'value' pairs. # Default: false -# -# [*timeout*] -# Allows setting the gunicorn idle worker process time before being killed. +# @param timeout Allows setting the gunicorn idle worker process time before being killed. # The unit of time is seconds. # Default: 30 -# -# [*template*] -# Which ERB template to use. Default: python/gunicorn.erb -# -# [*args*] -# Custom arguments to add in gunicorn config file. Default: [] -# -# === Examples -# -# 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', -# } -# -# === Authors -# -# Sergey Stankevich -# Ashley Penney -# Marc Fournier +# @param template Which ERB template to use. Default: python/gunicorn.erb +# @param args Custom arguments to add in gunicorn config file. Default: [] +# +# @example run gunicorn on vhost in virtualenv /var/www/project1 +# 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', +# } # define python::gunicorn ( $ensure = present, diff --git a/manifests/init.pp b/manifests/init.pp index 258d0677..212ea90c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,17 +1,8 @@ -# == Class: python +# @summary Installs and manages python, python-dev, python-virtualenv and gunicorn. # -# Installs and manages python, python-dev, python-virtualenv and Gunicorn. -# -# === Parameters -# -# [*ensure*] -# Desired installation state for the Python package. Valid options are absent, -# present and latest. Default: present -# -# [*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. -# Default: system default +# @param ensure Desired installation state for the Python package. +# Allowed values: absent, present and latest +# @param 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/... @@ -19,54 +10,28 @@ # - '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. -# -# [*pip*] -# Desired installation state for python-pip. Boolean values are deprecated. -# Default: present +# @param pip Desired installation state for python-pip. Boolean values are deprecated. # Allowed values: 'absent', 'present', 'latest' -# -# [*dev*] -# Desired installation state for python-dev. Boolean values are deprecated. -# Default: absent +# @param dev Desired installation state for python-dev. Boolean values are deprecated. # Allowed values: 'absent', 'present', 'latest' -# -# [*virtualenv*] -# Desired installation state for python-virtualenv. Boolean values are -# deprecated. Default: absent +# @param virtualenv Desired installation state for python-virtualenv. Boolean values are deprecated # Allowed values: 'absent', 'present', 'latest -# -# [*gunicorn*] -# Desired installation state for Gunicorn. Boolean values are deprecated. -# Default: absent +# @param gunicorn Desired installation state for Gunicorn. Boolean values are deprecated. # Allowed values: 'absent', 'present', 'latest' -# -# [*manage_gunicorn*] -# Allow Installation / Removal of Gunicorn. Default: true -# -# [*provider*] -# What provider to use for installation of the packages, except gunicorn and -# Python itself. Default: system default provider +# @param manage_gunicorn Allow Installation / Removal of Gunicorn. Default: true +# @param provider What provider to use for installation of the packages, except gunicorn and Python itself. # Allowed values: 'pip' +# @param use_epel to determine if the epel class is used. # -# [*use_epel*] -# Boolean to determine if the epel class is used. Default: true -# -# === Examples -# -# class { 'python': -# version => 'system', -# pip => 'present', -# dev => 'present', -# virtualenv => 'present', -# gunicorn => 'present', -# } +# @example ensure system python is installed, with pip,dev, virtualenv, and gunicorn packages present +# class { 'python': +# version => 'system', +# pip => 'present', +# dev => 'present', +# virtualenv => 'present', +# gunicorn => 'present', +# } # -# === Authors -# -# Sergey Stankevich -# Garrett Honeycutt -# - class python ( Enum['absent', 'present', 'latest'] $ensure = $python::params::ensure, $version = $python::params::version, diff --git a/manifests/install.pp b/manifests/install.pp index bddfd0ec..28505472 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,17 +1,8 @@ -# == Class: python::install # -# Installs core python packages, +# @summary Installs core python packages # -# === Examples -# -# include python::install -# -# === Authors -# -# Sergey Stankevich -# Ashley Penney -# Fotis Gimian -# Garrett Honeycutt +# @example +# include python::install # class python::install { diff --git a/manifests/params.pp b/manifests/params.pp index 5dacfc08..b68ed9ea 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,6 +1,5 @@ -# == Class: python::params # -# The python Module default configuration settings. +# @summary The python Module default configuration settings. # class python::params { $ensure = 'present' diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 587f1baa..058827da 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -1,51 +1,22 @@ -# == Define: python::pyvenv # -# Create a Python3 virtualenv using pyvenv. -# -# === Parameters -# -# [*ensure*] -# present|absent. Default: present -# -# [*version*] -# Python version to use. Default: system default -# -# [*systempkgs*] -# Copy system site-packages into virtualenv. Default: don't -# -# [*venv_dir*] -# Directory to install virtualenv to. Default: $name -# -# [*owner*] -# The owner of the virtualenv being manipulated. Default: root -# -# [*group*] -# The group relating to the virtualenv being manipulated. Default: root -# -# [*mode*] -# Optionally specify directory mode. Default: 0755 -# -# [*path*] -# Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] +# @summary Create a Python3 virtualenv using pyvenv. -# [*environment*] -# Optionally specify environment variables for pyvenv -# -# === Examples -# -# python::venv { '/var/www/project1': -# ensure => present, -# version => 'system', -# systempkgs => true, -# } -# -# === Authors +# @param ensure +# @param version Python version to use. Default: system default +# @param systempkgs Copy system site-packages into virtualenv +# @param venv_dir Directory to install virtualenv to +# @param owner The owner of the virtualenv being manipulated +# @param group The group relating to the virtualenv being manipulated +# @param mode Optionally specify directory mode +# @param path Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] +# @param environment Optionally specify environment variables for pyvenv # -# Sergey Stankevich -# Ashley Penney -# Marc Fournier -# Fotis Gimian -# Seth Cleveland +# @example +# python::venv { '/var/www/project1': +# ensure => present, +# version => 'system', +# systempkgs => true, +# } # define python::pyvenv ( $ensure = present, diff --git a/manifests/requirements.pp b/manifests/requirements.pp index ffdfd420..1127f5db 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -1,71 +1,27 @@ -# == Define: python::requirements # -# Installs and manages Python packages from requirements file. -# -# === Parameters -# -# [*requirements*] -# Path to the requirements file. Defaults to the resource name -# -# [*virtualenv*] -# virtualenv to run pip in. Default: system-wide -# -# [*pip_provider*] -# version of pip you wish to use. Default: pip -# -# [*owner*] -# The owner of the virtualenv being manipulated. Default: root -# -# [*group*] -# The group relating to the virtualenv being manipulated. Default: root -# -# [*proxy*] -# Proxy server to use for outbound connections. Default: none -# -# [*src*] -# Pip --src parameter; if the requirements file contains --editable resources, -# this parameter specifies where they will be installed. See the pip -# documentation for more. Default: none (i.e. use the pip default). -# -# [*environment*] -# Additional environment variables required to install the packages. Default: none -# -# [*forceupdate*] -# 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) -# -# [*cwd*] -# The directory from which to run the "pip install" command. Default: undef -# -# [*extra_pip_args*] -# Extra arguments to pass to pip after the requirements file -# -# [*manage_requirements*] -# Create the requirements file if it doesn't exist. Default: true -# -# [*fix_requirements_owner*] -# Change owner and group of requirements file. Default: true -# -# [*log_dir*] -# String. Log directory. -# -# [*timeout*] -# The maximum time in seconds the "pip install" command should take. Default: 1800 -# -# === Examples -# -# python::requirements { '/var/www/project1/requirements.txt': -# virtualenv => '/var/www/project1', -# proxy => 'http://proxy.domain.com:3128', -# } -# -# === Authors -# -# Sergey Stankevich -# Ashley Penney -# Fotis Gimian -# Daniel Quackenbush +# @summary Installs and manages Python packages from requirements file. +# +# @param requirements Path to the requirements file. Defaults to the resource name +# @param virtualenv virtualenv to run pip in. Default: system-wide +# @param pip_provider version of pip you wish to use. Default: pip +# @param owner The owner of the virtualenv being manipulated. +# @param group The group relating to the virtualenv being manipulated. +# @param proxy Proxy server to use for outbound connections. +# @param src Pip --src parameter; if the requirements file contains --editable resources, this parameter specifies where they will be installed. See the pip documentation for more. +# @param environment Additional environment variables required to install the packages. +# @param forceupdate 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) +# @param cwd The directory from which to run the "pip install" command. +# @param extra_pip_args Extra arguments to pass to pip after the requirements file +# @param manage_requirements Create the requirements file if it doesn't exist. +# @param fix_requirements_owner Change owner and group of requirements file. +# @param log_dir Log directory. +# @param timeout The maximum time in seconds the "pip install" command should take. +# +# @example install pip requirements from /var/www/project1/requirements.txt +# python::requirements { '/var/www/project1/requirements.txt': +# virtualenv => '/var/www/project1', +# proxy => 'http://proxy.domain.com:3128', +# } # define python::requirements ( $requirements = $name, diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index ad526678..c1a06ffe 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -1,79 +1,34 @@ -# == Define: python::virtualenv # -# Creates Python virtualenv. -# -# === Parameters -# -# [*ensure*] -# present|absent. Default: present -# -# [*version*] -# Python version to use. Default: system default -# -# [*requirements*] -# Path to pip requirements.txt file. Default: none -# -# [*systempkgs*] -# Copy system site-packages into virtualenv. Default: don't -# If virtualenv version < 1.7 this flag has no effect since -# -# [*venv_dir*] -# Directory to install virtualenv to. Default: $name -# -# [*ensure_venv_dir*] -# Create $venv_dir. Default: true -# -# [*distribute*] -# Include distribute in the virtualenv. Default: true -# -# [*index*] -# Base URL of Python package index. Default: none (http://pypi.python.org/simple/) -# -# [*owner*] -# The owner of the virtualenv being manipulated. Default: root -# -# [*group*] -# The group relating to the virtualenv being manipulated. Default: root -# -# [*mode*] -# Optionally specify directory mode. Default: 0755 -# -# [*proxy*] -# Proxy server to use for outbound connections. Default: none -# -# [*environment*] -# Additional environment variables required to install the packages. Default: none -# -# [*path*] -# Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] -# -# [*cwd*] -# The directory from which to run the "pip install" command. Default: undef -# -# [*timeout*] -# The maximum time in seconds the "pip install" command should take. Default: 1800 -# -# [*pip_args*] -# Arguments to pass to pip during initialization. Default: blank -# -# [*extra_pip_args*] -# Extra arguments to pass to pip after requirements file. Default: blank -# -# === Examples -# -# python::virtualenv { '/var/www/project1': -# ensure => present, -# version => 'system', -# requirements => '/var/www/project1/requirements.txt', -# proxy => 'http://proxy.domain.com:3128', -# systempkgs => true, -# index => 'http://www.example.com/simple/', -# } -# -# === Authors -# -# Sergey Stankevich -# Shiva Poudel +# @summary Creates Python virtualenv. +# +# @param ensure +# @param version Python version to use. +# @param requirements Path to pip requirements.txt file +# @param systempkgs Copy system site-packages into virtualenv. Default: don't If virtualenv version < 1.7 this flag has no effect since +# @param venv_dir Directory to install virtualenv to +# @param ensure_venv_dir reate $venv_dir +# @param distribute Include distribute in the virtualenv +# @param index Base URL of Python package index +# @param owner The owner of the virtualenv being manipulated +# @param group The group relating to the virtualenv being manipulated +# @param mode Optionally specify directory mode +# @param proxy Proxy server to use for outbound connections +# @param environment Additional environment variables required to install the packages +# @param path Specifies the PATH variable +# @param cwd The directory from which to run the "pip install" command +# @param timeout The maximum time in seconds the "pip install" command should take +# @param pip_args Arguments to pass to pip during initialization +# @param extra_pip_args Extra arguments to pass to pip after requirements file +# +# @example install a virtual env at /var/www/project1 +# python::virtualenv { '/var/www/project1': +# ensure => present, +# version => 'system', +# requirements => '/var/www/project1/requirements.txt', +# proxy => 'http://proxy.domain.com:3128', +# systempkgs => true, +# index => 'http://www.example.com/simple/', +# } # define python::virtualenv ( $ensure = present,