---
- name: Dependencies installed
  community.general.pkgng:
    name: py38-supervisor
    state: latest

- name: Supervisor enabled
  shell: sysrc supervisord_enable="YES"

- name: Supervisor config file patched
  patch:
    src: supervisord.conf.patch
    dest: /usr/local/etc/supervisord.conf

  notify: Supervisor restarted

- name: Ensures supervisor conf dir exists
  file: path=/usr/local/etc/supervisor/conf.d state=directory

- name: Ensure supervisor is running
  service:
    name: supervisord
    state: started
