Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error in init.d script and fix error in Debian version detection. #13

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tasks/statsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Ensure that NPM is installed
apt: name=npm update_cache=yes

- name: Prepare Statsd directory
file: state=directory path={{statsd_home}}

Expand All @@ -23,14 +23,14 @@
- "{{statsd_title}} restart"

- name: Configure sysvinit
template: src=sysvinit.conf.j2 dest=/etc/init.d/{{statsd_title}}
when: ansible_distribution=="Debian" and ansible_distribution_major_version < 8
template: src=sysvinit.j2 dest=/etc/init.d/{{statsd_title}} mode=755
when: ansible_distribution=="Debian" and ansible_distribution_major_version|int < 8
notify:
- "{{statsd_title}} restart"

- name: Configure systemd
template: src=systemd.service.j2 dest=/etc/systemd/system/{{statsd_title}}.service
when: ansible_distribution=="Debian" and ansible_distribution_major_version > 8
when: ansible_distribution=="Debian" and ansible_distribution_major_version|int > 8
notify:
- "{{statsd_title}} restart"

Expand Down
8 changes: 7 additions & 1 deletion templates/sysvinit.j2
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fi
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="StatsD"
NAME={{statsd_title}}
USER={statsd_user}}
USER={{statsd_user}}
DAEMON=$NODE_BIN
DAEMON_ARGS="{{statsd_home}}/node_modules/statsd/stats.js {{statsd_home}}/config.js"
PIDFILE=/var/run/$NAME/$NAME.pid
Expand All @@ -47,6 +47,12 @@ then
mkdir /var/run/$NAME
chown $USER /var/run/$NAME
fi
# Create log dir on runtime
if [ ! -d /var/log/$NAME ];
then
mkdir /var/log/$NAME
chown $USER /var/log/$NAME
fi

#
# Function that starts the daemon/service
Expand Down