Skip to content

Commit

Permalink
Merge pull request #11 from roumano/upstart
Browse files Browse the repository at this point in the history
Fix #10 : restart node exporter : failed when ansible_service_mgr: upstart
  • Loading branch information
UnderGreen authored Apr 27, 2017
2 parents f43ca83 + f1c767f commit d8f8516
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
- service reenable
- restart node exporter

- name: Looking which version of upstart is install
command: initctl version
when: ansible_service_mgr == 'upstart'
register: upstart_version

- name: create init service unit
template:
src: etc/init/prometheus-node-exporter.conf.j2
Expand Down
2 changes: 2 additions & 0 deletions templates/etc/init/prometheus-node-exporter.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]

respawn
{% if upstart_version.stdout | replace("init (upstart ", "") |replace(")","") | version_compare('1.4', '>=') %}
setuid root
setgid {{ prometheus_exporters_common_group }}
{% endif %}

script
exec >> "{{ prometheus_exporters_common_log_dir }}/node-exporter.log"
Expand Down

0 comments on commit d8f8516

Please sign in to comment.