Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Latest commit

 

History

History
190 lines (149 loc) · 6.19 KB

README.md

File metadata and controls

190 lines (149 loc) · 6.19 KB

#######################################################################################################

❗ DEPRECATION ❗

This repository and the role associated are deprecated in favor of the Manala Ansible Collection

You will find informations on its usage on the collection repository

#######################################################################################################

Ansible Role: Supervisor Build Status

Report issues and send Pull Requests in the main Ansible Role repository

This role will deal with the setup of Supervisor.

It's part of the Manala Ansible stack but can be used as a stand alone component.

Requirements

This role is made to work with the manala supervisor debian package, available on the manala debian repository. Please use the manala.apt role to handle it properly.

manala_apt_preferences:
  - supervisor@manala

Dependencies

None.

Installation

Ansible 2+

Using ansible galaxy cli:

ansible-galaxy install manala.supervisor

Using ansible galaxy requirements file:

- src: manala.supervisor

Role Handlers

Name Type Description
supervisor restart Service Restart supervisor service

Role Variables

Name Default Type Description
manala_supervisor_install_packages ~ Array Dependency packages to install
manala_supervisor_install_packages_default ['supervisor'] Array Default dependency packages to install
manala_supervisor_config_file '/etc/supervisor/supervisord.conf' String Main configuration file path
manala_supervisor_config_template 'config/_default.j2' String Main configuration template path
manala_supervisor_config ~ Array/String Main configuration directives
manala_supervisor_configs_exclusive false Boolean Exclusion of existing files additional configurations
manala_supervisor_configs_dir '/etc/supervisor/conf.d' String Additional configurations directory path
manala_supervisor_configs_defaults {} Array Additional configurations defaults
manala_supervisor_configs [] Array Additional configurations directives
manala_supervisor_log_dir '/var/log/supervisor' String Log directory path

Configuration example

Use debian default main config template (recommended):

manala_supervisor_config_template: config/debian/supervisord.conf.j2
manala_supervisor_config:
  supervisord:
    logfile: /var/log/supervisord.log # Change or add only some parameters

Start from a fresh empty main config, using dict parameters:

manala_supervisor_config:
  unix_http_server:
    file: /tmp/supervisor.sock
    chmod: "0700"
    chown: nobody:nogroup
  supervisord:
    logfile: /var/log/supervisord.log
    ...

Use raw main config:

manala_supervisor_config: |
  [unix_http_server]
  file=/tmp/supervisor.sock
  chmod=0700
  chown=nobody:nogroup

  [supervisord]
  logfile=/var/log/supervisord.log
  ...

Use dict's array parameters (deprecated):

manala_supervisor_config:
  - loglevel: info

Enable http server:

manala_supervisor_configs:
  # Template based (file name based on template)
  - template: configs/inet_http_server.conf.j2
    config:
      port: "*:9001"
  # Template based (force file name)
  - file: inet.conf
    template: configs/inet_http_server.conf.j2
    config:
      port: "*:9001"      

Programs:

manala_supervisor_configs:
  - file: programs_dict.conf
    config:
      program:foo:
        command: /bin/foo
        priority: 123
        autostart: true
        stopsignal: HUP
        environment:
          FOO: bar
          BAR: 123
      program:bar:
        command: /bin/bar
  - file: programs_raw.conf
    config: |
      [program:foo]
      command=/bin/foo
  - file: foo_dicts_array.conf # Deprecated
    config:
      - foo:
        - command: bar
        - environment:
            FOO: bar
            BAR: 12
  # Ensure config is absent
  - file: absent.conf
    state: absent # "present" by default
  # Ignore config
  - file: ignore.conf
    state: ignore
  # Flatten configs
  - "{{ my_custom_configs_array }}"

Raw content

manala_supervisor_configs:
  - file: bar.conf
    config: |
      [program:example]
      command=/usr/bin/example --loglevel=%(ENV_LOGLEVEL)s

manala_supervisor_configs_exclusive allow you to clean up existing supervisor configuration files into directory defined by the manala_supervisor_configs_dir key. Made to be sure no old or manually created files will alter current configuration.

manala_supervisor_configs_exclusive: true

Example playbook

- hosts: servers
  roles:
    - role: manala.supervisor

Licence

MIT

Author information

Manala (http://www.manala.io/)