Skip to content

Commit

Permalink
Fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmeijerman committed Dec 30, 2024
1 parent 9c4a18a commit a5bb024
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 27 deletions.
16 changes: 8 additions & 8 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
supervisord_unix_http_server_socket_file: "/var/run/supervisor.sock"
supervisord_unix_http_server_socket_mode: "0700"
supervisord_unix_http_server_socket_chown: "root:supervisord"
supervisord_unix_http_server_socket_file: "/var/run/supervisor.sock"
supervisord_unix_http_server_socket_mode: "0700"
supervisord_unix_http_server_socket_chown: "root:supervisord"

supervisord_logfile: "/var/log/supervisor/supervisord.log"
supervisord_pidfile: "/var/run/supervisord.pid"
supervisord_childlogdir: "/var/log/supervisor"
supervisord_logfile: "/var/log/supervisor/supervisord.log"
supervisord_pidfile: "/var/run/supervisord.pid"
supervisord_childlogdir: "/var/log/supervisor"

supervisord_supervisorctl_serverurl: "unix://{{ supervisord_unix_http_server_socket_file }}"
supervisord_supervisorctl_serverurl: "unix://{{ supervisord_unix_http_server_socket_file }}"

supervisord_include_path: "/etc/supervisor/conf.d"
supervisord_include_files: "{{ supervisord_include_path }}/*.conf"

supervisord_log_fatal_state_to_syslog: False
supervisord_log_fatal_state_to_syslog: false

python_package: "python"
16 changes: 13 additions & 3 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
---

- name: Reload supervisord configuration
command: supervisorctl reread
ansible.builtin.command: "supervisorctl reread"
notify: Apply supervisord changes
changed_when: false
tags:
- skip_ansible_lint

- name: Apply supervisord changes
command: supervisorctl update
ansible.builtin.command: "supervisorctl update" # noqa
changed_when: false
tags:
- skip_ansible_lint

- name: Restart supervisord
ansible.builtin.service:
name: supervisor
state: restarted
9 changes: 5 additions & 4 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
galaxy_info:
author: "Jasper N. Brouwer, Ramon de la Fuente"
role_name: "supervisord"
namespace: "f500"
description: Install and start supervisord
company: Future500
license: LGPL
min_ansible_version: "1.4"
platforms:
- name: Debian
versions:
- bullseye
- bookworm
- name: Debian
versions:
- bullseye
- bookworm
galaxy_tags:
- system
dependencies: []
34 changes: 22 additions & 12 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
---

- name: Install supervisord
apt: pkg=supervisor state=present
ansible.builtin.apt:
pkg: supervisor
state: present

- name: Create supervisord group
group: name=supervisord system=yes state=present
ansible.builtin.group:
name: supervisord
system: "yes"
state: present

- name: Add the supervisor fatals events listener
copy: src=files/supervisor-fatals-listener.py mode=755 dest=/usr/local/bin/supervisor-fatals-listener.py
ansible.builtin.copy:
src: files/supervisor-fatals-listener.py
mode: "0755"
dest: /usr/local/bin/supervisor-fatals-listener.py
when: supervisord_log_fatal_state_to_syslog

- name: Configure the supervisor fatals events listener
template:
ansible.builtin.template:
src: "files/supervisor.event.listeners.conf.j2"
dest: "/etc/supervisor/conf.d/eventlisteners.conf"
mode: "0644"
when: supervisord_log_fatal_state_to_syslog

- name: Create supervisord config
template: src=supervisord.conf.j2 dest=/etc/supervisor/supervisord.conf
ansible.builtin.template:
src: supervisord.conf.j2
dest: /etc/supervisor/supervisord.conf
mode: "0644"
register: supervisord_config_file

- name: Restart supervisord if the config task has changes
service: name=supervisor state=restarted
when: supervisord_config_file.changed
notify: Restart supervisord

- name: Start supervisord
service: name=supervisor state=started enabled=yes

ansible.builtin.service:
name: supervisor
state: started
enabled: "yes"

0 comments on commit a5bb024

Please sign in to comment.