geerlingguy.supervisor

Ansible Role: Supervisor

CI

This is an Ansible Role that installs Supervisor on Linux systems.

Requirements

Make sure you have Python’s pip installed. If it’s not installed, you can use the geerlingguy.pip Ansible role to install Pip before you run this role.

Role Variables

Here are the available settings you can use (see defaults/main.yml for default values):

  • supervisor_version: If you want a specific version of Supervisor, set it here. Check available Supervisor versions for options. If you don’t set a version, the latest stable one will be installed.

  • supervisor_started: true

  • supervisor_enabled: true
    Decide whether to use an init script or systemd unit to start Supervisor when installed or at system startup.

  • supervisor_config_path: /etc/supervisor
    This is the path where Supervisor configuration files will be stored.

  • supervisor_programs:
    This is a list of programs that Supervisor will manage. Here’s an example:

      - name: 'foo'
        command: /bin/cat
        state: present => (means it will be installed)
    
      - 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
    

    By default, this list is empty. To add a program, set state to present, and Supervisor will create a configuration file for it.

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

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

  • supervisor_user: root

  • supervisor_password: 'my_secret_password'
    These are the user and password for running supervisord and 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 by setting these 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.

Note: By default, this role enables a UNIX socket HTTP server that's accessible locally with the _user and _password specified above. Set a strong supervisor_password to avoid unauthorized access! If you don’t need the HTTP server or supervisorctl, you can disable it by setting this to false.

  • supervisor_inet_http_server_enable: false
  • supervisor_inet_http_server_port: '*:9001'
    Decide whether to enable the TCP-based HTTP server, and set the interface and port for it.

Dependencies

None.

Example Playbook

Here’s an example of how to use this role in a playbook:

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

If you want to use supervisorctl, you can either use Ansible’s built-in supervisorctl module, or run it like this (adjust the configuration path as needed):

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 geerlingguy.supervisor
Licenza
mit
Download
553.6k
Proprietario
Father, author, developer, maker. Sometimes called "an inflammatory enigma". #stl #drupal #ansible #k8s #raspberrypi #crohns