ansible.builtin.gunicorn (v2.9.27) — module

Run gunicorn with various settings.

| "added in version" 2.4 of ansible.builtin"

Authors: Alejandro Gomez (@agmezr)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: simple gunicorn run example
  gunicorn:
    app: 'wsgi'
    chdir: '/workspace/example'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: run gunicorn on a virtualenv
  gunicorn:
    app: 'wsgi'
    chdir: '/workspace/example'
    venv: '/workspace/example/venv'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: run gunicorn with a config file
  gunicorn:
    app: 'wsgi'
    chdir: '/workspace/example'
    conf: '/workspace/example/gunicorn.cfg'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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'

Inputs

    
app:
    aliases:
    - name
    description:
    - The app module. A name refers to a WSGI callable that should be found in the specified
      module.
    required: true

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.

user:
    description:
    - Switch worker processes to run as this user.

venv:
    aliases:
    - virtualenv
    description:
    - Path to the virtualenv directory.

chdir:
    description:
    - Chdir to specified directory before apps loading.

config:
    description:
    - Path to the gunicorn configuration file.

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.

Outputs

gunicorn:
  description: process id of gunicorn
  returned: changed
  sample: '1234'
  type: str