entanet_devops.ansible_role_supervisor

Ansible Role: Supervisor

Build Status

This Ansible Role installs Supervisor on Linux systems.

Requirements

You need to have Python's pip installed. If it’s not already installed, use the geerlingguy.pip Ansible role to install it before using this role.

Role Variables

Here are the available variables, along with their default values (check defaults/main.yml):

  • supervisor_version: latest
    Specify a version of Supervisor to install. The option latest installs the newest stable version. You can check available Supervisor versions on PyPI.

  • supervisor_started: true

  • supervisor_enabled: true
    These options determine if Supervisor should start automatically using an init script or systemd when installed or on system boot.

  • supervisor_config_path: /etc/supervisor
    The location where Supervisor configuration files will be stored.

  • supervisor_programs:

    - name: 'foo'
      command: /bin/cat
      state: present
    
    - name: 'apache'
      command: apache2ctl -DFOREGROUND
      state: present
      configuration: |
        autostart=true
        autorestart=true
        startretries=1
        startsecs=1
        redirect_stderr=true
        stderr_logfile=/var/log/apache-err.log
        stdout_logfile=/var/log/apache-out.log
        user=root
        killasgroup=true
        stopasgroup=true
    

    This is an empty list by default. You can define programs that Supervisor should manage. If state is set to present, a configuration file for that program will be created.

  • supervisor_nodaemon: false
    Set to true if you want to run Supervisor in the foreground.

  • supervisor_log_dir: /var/log/supervisor
    This is where Supervisor logs will be saved.

  • supervisor_user: root

  • supervisor_password: 'my_secret_password'
    The user and password for accessing Supervisor’s HTTP server.

  • supervisor_unix_http_server_password_protect: true

  • supervisor_inet_http_server_password_protect: true
    You can turn off password protection for these servers by setting these variables to false.

  • supervisor_unix_http_server_enable: true

  • supervisor_unix_http_server_socket_path: /var/run/supervisor.sock
    Enable the UNIX socket-based HTTP server and specify the socket file location.

Note: This role enables an HTTP server via a UNIX socket for local access using the provided user and password. Make sure to set a strong supervisor_password to avoid unauthorized access! If you don't need the HTTP server or supervisorctl, disable the UNIX HTTP server by setting this variable to false.

  • supervisor_inet_http_server_enable: false
  • supervisor_inet_http_server_port: '*:9001'
    Enable the TCP-based HTTP server and set the interface and port for it.

Dependencies

None.

Example Playbook

- hosts: all
  roles:
    - geerlingguy.pip
    - geerlingguy.supervisor

If you need to use supervisorctl, you can use Ansible's built-in supervisorctl module for management, or run it manually like this (with the configuration directory path):

supervisorctl -c /etc/supervisor/supervisord.conf -u root -p [password] status all

License

MIT / BSD

Author Information

This role was created in 2017 by Jeff Geerling, the author of Ansible for DevOps.

Informazioni sul progetto

Supervisor (process state manager) for Linux.

Installa
ansible-galaxy install entanet_devops.ansible_role_supervisor
Licenza
mit
Download
261
Proprietario