Skip to content
This repository has been archived by the owner on Jul 5, 2020. It is now read-only.

infOpen/ansible-role-uwsgi

Repository files navigation

uwsgi

Build Status Build Status Updates Python 3 Ansible Role

Install uwsgi package.

Requirements

This role requires Ansible 2.2 or higher, and platform requirements are listed in the metadata file.

Testing

This role use Molecule to run tests.

Local and Travis tests run tests on Docker by default. See molecule documentation to use other backend.

Currently, tests are done on:

  • Debian Jessie
  • Ubuntu Trusty
  • Ubuntu Xenial

and use:

  • Ansible 2.2.x
  • Ansible 2.3.x
  • Ansible 2.4.x

Running tests

Using Docker driver

$ tox

Role Variables

Default role variables

# Installation vars
uwsgi_install_mode: 'package'
uwsgi_packages: "{{ _uwsgi_packages }}"
uwsgi_service_name: 'uwsgi'

# Configuration vars
uwsgi_configuration_available_path: "{{ _uwsgi_configuration_available_path }}"
uwsgi_configuration_enabled_path: "{{ _uwsgi_configuration_enabled_path }}"
uwsgi_configuration_log_path: "{{ _uwsgi_configuration_log_path }}"
uwsgi_configuration_run_path: "{{ _uwsgi_configuration_run_path }}"
uwsgi_configuration_owner: 'root'
uwsgi_configuration_group: 'root'
uwsgi_configuration_mode: '0640'
uwsgi_apps: []
uwsgi_apps_defaults: "{{ _uwsgi_apps_defaults }}"

# Handler management
uwsgi_restart_handler_enabled: True

Debian family variables

# Package management
_uwsgi_packages:
  - name: 'uwsgi'
  - name: 'uwsgi-plugin-python'
  - name: 'uwsgi-plugin-python3'

# Configuration management
_uwsgi_configuration_available_path: '/etc/uwsgi/apps-available'
_uwsgi_configuration_enabled_path: '/etc/uwsgi/apps-enabled'
_uwsgi_configuration_log_path: '/var/log/uwsgi'
_uwsgi_configuration_run_path: '/var/run/uwsgi'
_uwsgi_apps_defaults:
  uwsgi:
    autoload: true
    master: true
    workers: 2
    no-orphans: true
    pidfile: "{{ uwsgi_configuration_run_path ~ '/%(deb-confnamespace)/%(deb-confname)/pid' }}"
    socket: "{{ uwsgi_configuration_run_path ~ '/%(deb-confnamespace)/%(deb-confname)/socket' }}"
    logto: "{{ uwsgi_configuration_log_path ~ '/%(deb-confnamespace)/%(debconfname).log' }}"
    chmod-socket: 660
    log-date: true
    uid: www-data
    gid: www-data

Dependencies

None

Example Playbook

- hosts: servers
  roles:
    - { role: infOpen.uwsgi }

License

MIT

Author Information

Alexandre Chaussier (for Infopen company)