add supervisor role
This commit is contained in:
parent
3a14992832
commit
49be68b4db
24
roles/supervisor/defaults/main.yaml
Normal file
24
roles/supervisor/defaults/main.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
supervisor_package_name: supervisor
|
||||||
|
supervisor_package_state: present
|
||||||
|
|
||||||
|
supervisor_service_name: supervisor
|
||||||
|
supervisor_service_state: started
|
||||||
|
supervisor_service_enabled: true
|
||||||
|
|
||||||
|
supervisor_etc_path: /etc/supervisor
|
||||||
|
supervisor_config_path: "{{ supervisor_etc_path }}/supervisord.conf"
|
||||||
|
supervisor_config_owner: root
|
||||||
|
supervisor_config_group: root
|
||||||
|
supervisor_config_mode: "0644"
|
||||||
|
|
||||||
|
supervisor_unix_http_server_socket_file: /var/run/supervisor.sock
|
||||||
|
supervisor_unix_http_server_socket_chmod: "0700"
|
||||||
|
|
||||||
|
supervisor_supervisord_logfile: /var/log/supervisor/supervisord.log
|
||||||
|
supervisor_supervisord_pidfile: /var/run/supervisord.pid
|
||||||
|
supervisor_supervisord_childlogdir: /var/log/supervisor
|
||||||
|
|
||||||
|
supervisor_supervisorctl_serverurl: "unix://{{ supervisor_unix_http_server_socket_file }}"
|
||||||
|
|
||||||
|
supervisor_include_files: /etc/supervisor/conf.d/*.conf
|
5
roles/supervisor/handlers/main.yaml
Normal file
5
roles/supervisor/handlers/main.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: restart supervisor
|
||||||
|
service:
|
||||||
|
name: "{{ supervisor_service_name }}"
|
||||||
|
state: restarted
|
0
roles/supervisor/tasks/default.yaml
Normal file
0
roles/supervisor/tasks/default.yaml
Normal file
44
roles/supervisor/tasks/main.yaml
Normal file
44
roles/supervisor/tasks/main.yaml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
---
|
||||||
|
- name: gather os specific variables
|
||||||
|
include_vars: "{{ lookup('first_found', possible_files) }}"
|
||||||
|
vars:
|
||||||
|
possible_files:
|
||||||
|
files:
|
||||||
|
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
|
||||||
|
- "{{ ansible_distribution }}.yaml"
|
||||||
|
- "{{ ansible_os_family }}.yaml"
|
||||||
|
- "default.yaml"
|
||||||
|
paths:
|
||||||
|
- vars
|
||||||
|
|
||||||
|
- name: include os specific tasks
|
||||||
|
include_tasks: "{{ lookup('first_found', possible_files) }}"
|
||||||
|
vars:
|
||||||
|
possible_files:
|
||||||
|
files:
|
||||||
|
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
|
||||||
|
- "{{ ansible_distribution }}.yaml"
|
||||||
|
- "{{ ansible_os_family }}.yaml"
|
||||||
|
- "default.yaml"
|
||||||
|
paths:
|
||||||
|
- tasks
|
||||||
|
|
||||||
|
- name: install package
|
||||||
|
package:
|
||||||
|
name: "{{ supervisor_package_name }}"
|
||||||
|
state: "{{ supervisor_package_state }}"
|
||||||
|
|
||||||
|
- name: configure
|
||||||
|
template:
|
||||||
|
src: supervisord.conf.j2
|
||||||
|
dest: "{{ supervisor_config_path }}"
|
||||||
|
owner: "{{ supervisor_config_owner }}"
|
||||||
|
group: "{{ supervisor_config_group }}"
|
||||||
|
mode: "{{ supervisor_config_mode }}"
|
||||||
|
notify: restart supervisor
|
||||||
|
|
||||||
|
- name: manage service
|
||||||
|
service:
|
||||||
|
name: "{{ supervisor_service_name }}"
|
||||||
|
state: "{{ supervisor_service_state }}"
|
||||||
|
enabled: "{{ supervisor_service_enabled }}"
|
26
roles/supervisor/templates/supervisord.conf.j2
Normal file
26
roles/supervisor/templates/supervisord.conf.j2
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
; {{ ansible_managed }}
|
||||||
|
|
||||||
|
[unix_http_server]
|
||||||
|
{% if supervisor_unix_http_server_socket_file is defined %}
|
||||||
|
file={{ supervisor_unix_http_server_socket_file }}
|
||||||
|
{% endif %}
|
||||||
|
{% if supervisor_unix_http_server_socket_chmod is defined %}
|
||||||
|
chmod={{ supervisor_unix_http_server_socket_chmod }}
|
||||||
|
{% endif %}
|
||||||
|
{% if supervisor_unix_http_server_socket_chown is defined %}
|
||||||
|
chown={{ supervisor_unix_http_server_socket_chown }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[supervisord]
|
||||||
|
logfile={{ supervisor_supervisord_logfile }}
|
||||||
|
pidfile={{ supervisor_supervisord_pidfile }}
|
||||||
|
childlogdir={{ supervisor_supervisord_childlogdir }}
|
||||||
|
|
||||||
|
[rpcinterface:supervisor]
|
||||||
|
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||||
|
|
||||||
|
[supervisorctl]
|
||||||
|
serverurl={{ supervisor_supervisorctl_serverurl }}
|
||||||
|
|
||||||
|
[include]
|
||||||
|
files = {{ supervisor_include_files }}
|
0
roles/supervisor/vars/default.yaml
Normal file
0
roles/supervisor/vars/default.yaml
Normal file
Loading…
Reference in New Issue
Block a user