�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l Z d d l m
Z
d
� Z d � Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
module: gunicorn
version_added: "2.4"
short_description: Run gunicorn with various settings.
description:
- Starts gunicorn with the parameters specified. Common settings for gunicorn
configuration are supported. For additional configuration use a config file
See U(https://gunicorn-docs.readthedocs.io/en/latest/settings.html) for more
options. It's recommended to always use the chdir option to avoid problems
with the location of the app.
requirements: [gunicorn]
author:
- "Alejandro Gomez (@agmezr)"
options:
app:
required: true
aliases: ['name']
description:
- The app module. A name refers to a WSGI callable that should be found in the specified module.
venv:
aliases: ['virtualenv']
description:
- 'Path to the virtualenv directory.'
config:
description:
- 'Path to the gunicorn configuration file.'
chdir:
description:
- 'Chdir to specified directory before apps loading.'
pid:
description:
- 'A filename to use for the PID file. If not set and not found on the configuration file a tmp
pid file will be created to check a successful run of gunicorn.'
worker:
choices: ['sync', 'eventlet', 'gevent', 'tornado ', 'gthread', 'gaiohttp']
description:
- 'The type of workers to use. The default class (sync) should handle most "normal" types of workloads.'
user:
description:
- 'Switch worker processes to run as this user.'
notes:
- If not specified on config file, a temporary error log will be created on /tmp dir.
Please make sure you have write access in /tmp dir. Not needed but will help you to
identify any problem with configuration.
s�
- name: simple gunicorn run example
gunicorn:
app: 'wsgi'
chdir: '/workspace/example'
- name: run gunicorn on a virtualenv
gunicorn:
app: 'wsgi'
chdir: '/workspace/example'
venv: '/workspace/example/venv'
- name: run gunicorn with a config file
gunicorn:
app: 'wsgi'
chdir: '/workspace/example'
conf: '/workspace/example/gunicorn.cfg'
- name: run gunicorn as ansible user with specified pid and config file
gunicorn:
app: 'wsgi'
chdir: '/workspace/example'
conf: '/workspace/example/gunicorn.cfg'
venv: '/workspace/example/venv'
pid: '/workspace/example/gunicorn.pid'
user: 'ansible'
sj
gunicorn:
description: process id of gunicorn
returned: changed
type: str
sample: "1234"
N( t
AnsibleModulec C` s^ | rZ t j j | � rZ d } t | d � �( } x | D] } | | k r7 | Sq7 WWd QXn d S( s, search in config file for specified option t rN( t ost patht isfilet Nonet open( t configt optiont data_configt ft line( ( sO /usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/gunicorn.pyt search_existing_configj s
c C` s&