buluma.supervisor
Ansible Role Supervisor
Supervisor is a process manager for Linux.
| GitHub | Version | Issues | Pull Requests | Downloads | 
|---|---|---|---|---|
Example Playbook
Here is an example playbook from molecule/default/converge.yml. It is tested with each update, pull request, and release.
---
- name: Converge
  hosts: all
  become: true
  environment:
    PATH: "/usr/local/bin:{{ ansible_env.PATH }}"
  vars:
    supervisor_user: root
    supervisor_password: fizzbuzz
  pre_tasks:
    - name: Update apt cache (Debian).
      apt: update_cache=true cache_valid_time=600
      when: ansible_os_family == 'Debian'
    - name: Install curl for testing.
      package: name=curl state=present
    - block:
        - name: Install Apache (RedHat).
          package: name=httpd state=present
        - name: Ensure Apache is not running (RedHat).
          service: name=httpd state=stopped enabled=no
      when: ansible_os_family == 'RedHat'
    - block:
        - name: Install Apache (Debian).
          package: name=apache2 state=present
        - name: Ensure Apache is not running (Debian).
          service: name=apache2 state=stopped enabled=no
      when: ansible_os_family == 'Debian'
    - name: Create a test HTML file.
      ansible.builtin.copy:
        content: "<html><head><title>Test</title></head><body>Test.</body></html>"
        dest: /var/www/html/index.html
        force: false
        group: root
        owner: root
        mode: 0644
    - name: Set Apache start command (Debian).
      ansible.builtin.set_fact:
        apache_start_command: apache2ctl -DFOREGROUND
      when: ansible_os_family == 'Debian'
    - name: Set Apache start command (RedHat).
      ansible.builtin.set_fact:
        apache_start_command: httpd -DFOREGROUND
      when: ansible_os_family == 'RedHat'
    - name: Add Apache to supervisor programs.
      ansible.builtin.set_fact:
        supervisor_programs:
          - name: 'apache'
            command: "{{ apache_start_command }}"
            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
  roles:
    - role: buluma.supervisor
  tasks:
    - name: Trigger handlers to start supervisor.
      ansible.builtin.meta: flush_handlers
  post_tasks:
    - name: Wait for Apache to start.
      ansible.builtin.wait_for:
        port: 80
        delay: 2
    - name: Check if Apache is responding.
      ansible.builtin.uri:
        url: http://127.0.0.1/
        method: GET
        status_code: 200
    - name: Check if supervisorctl is available.
      command: supervisorctl --help
      args:
        warn: false
      changed_when: false
    - name: Verify supervisorctl works with UNIX socket.
      community.general.supervisorctl:
        name: apache
        state: restarted
        username: "{{ supervisor_user }}"
        password: "{{ supervisor_password }}"
      changed_when: false
    - name: Check supervisorctl status.
      command: supervisorctl status
      args:
        warn: false
      changed_when: false
The machine needs to be prepared. In CI, this is done using molecule/default/prepare.yml:
---
- name: Prepare
  hosts: all
  gather_facts: no
  become: yes
  serial: 30%
  roles:
    - role: buluma.bootstrap
    - role: buluma.pip
    - role: buluma.core_dependencies
You can view a full explanation and example of how to use these roles.
Role Variables
Default values for the variables are set in defaults/main.yml:
---
# Specify a version of Supervisor here (e.g. '3.3.1').
supervisor_version: ''
# Choose to use an init script or systemd to start Supervisor when installed or after boot.
supervisor_started: true
supervisor_enabled: true
supervisor_config_path: /etc/supervisor
# List of programs Supervisor will manage. Example below is commented out.
supervisor_programs: []
# - name: 'apache'
#   command: apache2ctl -c "ErrorLog /dev/stdout" -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
supervisor_nodaemon: false
supervisor_log_dir: /var/log/supervisor
supervisor_user: root
supervisor_password: 'my_secret_password'
supervisor_unix_http_server_enable: true
supervisor_unix_http_server_socket_path: /var/run/supervisor.sock
supervisor_unix_http_server_password_protect: true
supervisor_inet_http_server_enable: false
supervisor_inet_http_server_port: '*:9001'
supervisor_inet_http_server_password_protect: true
Requirements
- Pip packages listed in requirements.txt.
 
State of Used Roles
These roles are used to prepare a system. You can use other methods to prepare your system.
| Requirement | GitHub | Version | 
|---|---|---|
| buluma.bootstrap | ||
| buluma.pip | ||
| buluma.core_dependencies | 
Context
This role is part of multiple compatible roles. You can find more information in the documentation of these roles.
Here is an overview of related roles:

Compatibility
This role has been tested on these container images:
| Container | Tags | 
|---|---|
| EL | 8 | 
| Debian | all | 
| Ubuntu | all | 
| Kali | all | 
You need at least Ansible version 2.12. Testing has been done on:
- The previous version.
 - The current version.
 - The development version.
 
If you encounter problems, please report them on GitHub.
Changelog
You can review Role History.
License
This project is licensed under Apache-2.0.
Author Information
Created by Shadow Walker.
Supervisor (process state manager) for Linux.
ansible-galaxy install buluma.supervisor