OpenStack-Ansible uWSGI role

This role installs uwsgi service either inside it’s own virtualenv or with the system python and creates systemd services based on the provided definitions inside variable uwsgi_services.

To clone or view the source code for this repository, visit the role repository for uwsgi.

Default variables

uwsgi_system_user_name: uwsgi
uwsgi_system_group_name: uwsgi
uwsgi_system_slice_name: uwsgi
uwsgi_lock_dir: "{{ openstack_lock_dir | default('/run/lock') }}"
uwsgi_run_dir: "{{ openstack_run_dir | default('/run') }}"

# Set installation method. Valid options: source, distro
uwsgi_install_method: source

# Virtual env suffix to deploy into
uwsgi_venv_tag: "{{ venv_tag | default('untagged') }}"

uwsgi_pip_install_args: "{{ pip_install_options | default('') }}"
uwsgi_python_executable: "python3"

uwsgi_package_state: "latest"

# Default environment variables to set for uwsgi process
uwsgi_env: "{{ _uwsgi_env }}"

# Define uwsgi_services for deployment of uwsgi. You should provide
# at least wsgi_path and uwsgi_port. wsgi_venv should be defined for
# services installed inside virtualenv.
# Example structure:
# uwsgi_services:
#   service:
#     service_name: service-api
#     wsgi_path: /openstack/venvs/api/bin/wsgi-api
#     wsgi_venv: /openstack/venvs/api
#     init_config_overrides: {}
#     uwsgi_uid: root
#     uwsgi_guid: root
#     uwsgi_overrides: {}
#     uwsgi_processes: [ansible_facts['processor_vcpus'] | default(1), 1] | max * 2
#     uwsgi_threads: 1
#     uwsgi_bind_address: 0.0.0.0   # OR a list, uwsgi_bind_address: [ '127.0.0.1', '1.2.3.4' ]
#     uwsgi_port: 8080
#     uwsgi_env: "FOO=bar"
#     uwsgi_tls:
#       crt: /path/to/crt
#       key: /path/to/key
#     uwsgi_pyargv: "--foo=bar --config_file=/etc/foo/foo.conf"
uwsgi_services: {}

# Override can be used to apply config change to all uwsgi services
# instead of adjusting each service separately
uwsgi_ini_overrides: {}
uwsgi_init_config_overrides: {}

Example playbook

---
- name: Install uwsgi service
  hosts: localhost
  user: root
  roles:
    - role: "uwsgi"
  vars:
    uwsgi_services:
      api:
        wsgi_path: /openstack/venvs/api/bin/wsgi-api
        wsgi_venv: /openstack/venvs/api

Tags

This role supports two tags: uwsgi-install and uwsgi-config. The uwsgi-install tag can be used to install and upgrade. The uwsgi-config tag can be used to manage configuration and systemd services.