Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update modules with defined types for variables as described in docs/Add reference.md #440

Merged
merged 9 commits into from
Oct 26, 2018
1,099 changes: 1,099 additions & 0 deletions REFERENCE.md

Large diffs are not rendered by default.

15 changes: 3 additions & 12 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -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 <| |>
Expand Down
45 changes: 17 additions & 28 deletions manifests/dotfile.pp
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
95 changes: 30 additions & 65 deletions manifests/gunicorn.pp
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
73 changes: 19 additions & 54 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,72 +1,37 @@
# == 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/...
# - 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.
#
# [*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 <[email protected]>
#

class python (
Enum['absent', 'present', 'latest'] $ensure = $python::params::ensure,
$version = $python::params::version,
Expand Down
15 changes: 3 additions & 12 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
# @example
# include python::install
#
class python::install {

Expand Down
3 changes: 1 addition & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Loading