Skip to content

Commit 6a3c2ff

Browse files
authored
Merge pull request #33 from Oefenweb/add-1604-support
Add support for Ubuntu 16.04
2 parents 764f278 + 492ffd9 commit 6a3c2ff

12 files changed

Lines changed: 113 additions & 23 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ supervisor_programs_present:
9696
stderr_logfile_maxbytes: 0
9797
user: vagrant
9898
numprocs: 8
99-
process_name: %(program_name)s-%(process_num)s
99+
process_name: '%(program_name)s-%(process_num)s'
100100
bar:
101101
command: 'sleep 10'
102102
directory: /tmp

Vagrantfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ boxes = [
1818
:cpu => "50",
1919
:ram => "256"
2020
},
21+
{
22+
:name => "ubuntu-1604",
23+
:box => "bento/ubuntu-16.04",
24+
:ip => '10.0.0.13',
25+
:cpu => "50",
26+
:ram => "256"
27+
},
2128
]
2229

2330
Vagrant.configure("2") do |config|

defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ supervisor_inet_http_server_port: 9001
1515
supervisor_inet_http_server_username: admin
1616
supervisor_inet_http_server_password: '4ubA&Et=ASPe'
1717

18+
supervisor_supervisord_restart_sec: 5
19+
1820
supervisor_supervisord_nodaemon: false
1921
supervisor_supervisord_logfile: /var/log/supervisor/supervisord.log
2022
supervisor_supervisord_pidfile: /var/run/supervisord.pid

meta/main.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ galaxy_info:
77
license: MIT
88
min_ansible_version: 1.6
99
platforms:
10-
- name: Ubuntu
11-
versions:
12-
- precise
13-
- trusty
10+
- name: Ubuntu
11+
versions:
12+
- precise
13+
- trusty
14+
- xenial
1415
galaxy_tags:
1516
- web
1617
- system

tasks/configure.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
path: "{{ item }}/"
66
register: stat_directories
77
with_items:
8+
- "{{ supervisor_default_file | dirname }}"
89
- "{{ supervisor_configuration_file | dirname }}"
910
- "{{ supervisor_unix_http_server_file | dirname }}"
1011
- "{{ supervisor_supervisord_logfile | dirname }}"
@@ -28,26 +29,26 @@
2829
- supervisor-configure-directories
2930
- supervisor-configure-directories-create
3031

31-
- name: configure | update configuration file - /etc/supervisor/supervisord.conf
32+
- name: configure | update configuration file - /etc/default/supervisor
3233
template:
33-
src: etc/supervisor/supervisord.conf.j2
34-
dest: "{{ supervisor_configuration_file }}"
34+
src: "{{ supervisor_default_file.lstrip('/') }}.j2"
35+
dest: "{{ supervisor_default_file }}"
3536
owner: "{{ supervisor_system_user }}"
3637
group: "{{ supervisor_system_group }}"
37-
mode: 0640
38+
mode: 0644
3839
notify: restart supervisor
3940
tags:
4041
- supervisor-configure-configuration
41-
- supervisor-configure-configuration-supervisord-conf
42+
- supervisor-configure-configuration-default-supervisor
4243

43-
- name: configure | update init script - /etc/init.d/supervisor
44+
- name: configure | update configuration file - /etc/supervisor/supervisord.conf
4445
template:
45-
src: etc/init.d/supervisor.j2
46-
dest: /etc/init.d/supervisor
46+
src: "{{ supervisor_configuration_file.lstrip('/') }}.j2"
47+
dest: "{{ supervisor_configuration_file }}"
4748
owner: "{{ supervisor_system_user }}"
4849
group: "{{ supervisor_system_group }}"
49-
mode: 0755
50+
mode: 0640
5051
notify: restart supervisor
5152
tags:
5253
- supervisor-configure-configuration
53-
- supervisor-configure-configuration-init
54+
- supervisor-configure-configuration-supervisord-conf

tasks/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@
1212
- supervisor
1313
- supervisor-configure
1414

15+
- include: service-initd.yml
16+
when: ansible_distribution_version | version_compare('15.04', '<')
17+
tags:
18+
- configuration
19+
- supervisor
20+
- supervisor-configure
21+
- supervisor-configure-initd
22+
23+
- include: service-systemd.yml
24+
when: ansible_distribution_version | version_compare('15.04', '>=')
25+
tags:
26+
- configuration
27+
- supervisor
28+
- supervisor-configure
29+
- supervisor-configure-systemd
30+
1531
- include: programs.yml
1632
tags:
1733
- configuration

tasks/service-initd.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# tasks file for supervisor
2+
---
3+
- name: configure | initd | update script
4+
template:
5+
src: etc/init.d/supervisor.j2
6+
dest: /etc/init.d/supervisor
7+
owner: "{{ supervisor_system_user }}"
8+
group: "{{ supervisor_system_group }}"
9+
mode: 0755
10+
notify: restart supervisor
11+
tags:
12+
- supervisor-service-upstart-update

tasks/service-systemd.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# tasks file for supervisor
2+
---
3+
- name: configure | systemd | update script
4+
template:
5+
src: templates/lib/systemd/system/supervisor.j2
6+
dest: /lib/systemd/system/supervisor.service
7+
owner: "{{ supervisor_system_user }}"
8+
group: "{{ supervisor_system_group }}"
9+
mode: 0644
10+
register: _update_systemd_script
11+
notify: restart supervisor
12+
tags:
13+
- supervisor-service-systemd-update
14+
15+
- name: service | systemd | reload
16+
command: systemctl daemon-reload
17+
when: _update_systemd_script | changed
18+
tags:
19+
- supervisor-service-systemd-reload
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# {{ ansible_managed }}
2+
#
3+
DAEMON_OPTS=""

templates/etc/init.d/supervisor.j2

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,22 @@
3030
. /lib/lsb/init-functions
3131

3232
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
33-
DAEMON=/usr/local/bin/supervisord
34-
SUPERVISORCTL=/usr/local/bin/supervisorctl
33+
DAEMON={{ supervisor_install_prefix }}/supervisord
34+
SUPERVISORCTL={{ supervisor_install_prefix }}/supervisorctl
3535
NAME=supervisord
3636
DESC=supervisor
3737

3838
test -x $DAEMON || exit 0
3939

4040
LOGDIR={{ supervisor_supervisord_logfile | dirname }}
4141
PIDFILE={{ supervisor_supervisord_pidfile }}
42-
DODTIME=5 # Time to wait for the server to die, in seconds
43-
# If this value is set too low you might not
44-
# let some servers to die gracefully and
45-
# 'restart' will not work
42+
# Time to wait for the server to die, in seconds. If this value is set too low you might not let some servers to die
43+
# gracefully and 'restart' will not work
44+
DODTIME={{ supervisor_supervisord_restart_sec }}
4645

4746
# Include supervisor defaults if available
48-
if [ -f /etc/default/supervisor ] ; then
49-
. /etc/default/supervisor
47+
if [ -f {{ supervisor_default_file }} ] ; then
48+
. {{ supervisor_default_file }}
5049
fi
5150
DAEMON_OPTS="-c {{ supervisor_configuration_file }} $DAEMON_OPTS"
5251

0 commit comments

Comments
 (0)