cchurch.uwsgi

uWSGI

This guide is about installing uWSGI in emperor mode and setting up vassals. It requires Ansible version 2.4 or newer.

Role Variables

Important: Some variable names have changed since version 0.2.x!

You can set these variables to customize the setup:

  • uwsgi_install: Choose how to install uWSGI. Use "pkg" (default) for the system package manager or "pip" for pip installation. Any other value means uWSGI is installed differently.
  • uwsgi_version: If you choose "pip", specify the uWSGI version to install. By default, it installs the latest version.
  • uwsgi_virtualenv: If using "pip", provide the path for the virtual environment where uWSGI should be installed.
  • uwsgi_vassals: Create INI configuration files for specified vassals. This must be a list of dictionaries, where each dictionary must have a name key for the file name. All key-value pairs get written to the INI file in the [uwsgi] section. Default is an empty list [].
  • uwsgi_vassals_to_remove: Names of vassals you want to remove. Default is an empty list [].

For customizing the emperor's configuration and paths:

  • uwsgi_emperor_tyrant: Run the emperor in tyrant mode, making vassal config files owned by the specified user/group. Default is true when using "pip" and false otherwise.
  • uwsgi_conf_template: Local template for the uWSGI emperor configuration. Default depends on the package manager; it evaluates to different templates for different operating systems.
  • uwsgi_conf_path: Path to the uWSGI emperor config file. Default also depends on the package manager and OS.
  • uwsgi_conf_force: Whether to overwrite the uWSGI emperor config file. Default is false (only create if it doesn’t exist).
  • uwsgi_vassal_path: Path where the emperor looks for vassal config files. The default varies depending on the package manager and OS.

To customize installed packages supporting uWSGI:

  • uwsgi_os_packages: List of system packages for uWSGI support. The default depends on the installation method.
  • uwsgi_pip_packages: List of pip packages for uWSGI support when using "pip" installation. Default is ["uwsgi"].
  • uwsgi_pip_executable: Alternate pip path/name when installing packages without a virtual environment. Default is determined automatically.

For service configuration when uWSGI is not installed via the system manager:

  • uwsgi_user_group: User/group info for running uWSGI. Default creates system user and group, usually uwsgi:uwsgi or www-data:www-data depending on the OS.
  • uwsgi_service_name: Name of the uWSGI service. Default varies by OS.
  • uwsgi_bin: Path to uWSGI binary for service configuration. Automatically determined if not specified.
  • uwsgi_opts: Command line options for running uWSGI. Defaults to options specified in the configuration file.
  • uwsgi_use_upstart: Whether to use upstart for managing uWSGI. It is undefined by default but can be disabled explicitly.
  • uwsgi_upstart_packages: List of packages for running uWSGI via upstart.
  • uwsgi_upstart_description: Description for the uWSGI upstart service.
  • uwsgi_upstart_template: Local template for uWSGI upstart configuration.
  • uwsgi_upstart_path: Path for upstart uWSGI configuration.
  • uwsgi_use_systemd: Whether to use systemd for managing uWSGI. Undefined by default and can be disabled explicitly.
  • uwsgi_systemd_template: Local template for systemd uWSGI service.
  • uwsgi_systemd_path: Path for systemd uWSGI server.

Example Playbook

Here’s an example playbook that installs uWSGI via pip and configures a vassal for a Django site:

- hosts: all
  roles:
    - role: cchurch.uwsgi
      vars:
        uwsgi_install: pip
        uwsgi_vassals:
          - name: example
            plugin: python
            chdir: /opt/example/src
            module: example.wsgi
            home: /opt/example/env
            env: DJANGO_SETTINGS_MODULE=example.settings
            processes: 4
            socket: 127.0.0.1:8000
            uid: example
            gid: example

License

BSD

Author Information

Chris Church (cchurch)

Informazioni sul progetto

Install uWSGI in emperor mode and configure vassals.

Installa
ansible-galaxy install cchurch.uwsgi
Licenza
other
Download
4.8k
Proprietario
Python/Django/Ansible, will code for sweet tea and beer.