mirror of
https://github.com/roles-ansible/ansible_role_prometheus_ping_exporter.git
synced 2024-08-16 10:19:51 +02:00
deploy systemd file
This commit is contained in:
parent
9c85eef92a
commit
e5d1924864
6 changed files with 36 additions and 4 deletions
|
@ -2,7 +2,7 @@
|
||||||
- name: Create ping exporter config
|
- name: Create ping exporter config
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: 'templates/ping_exporter_config.yml'
|
src: 'templates/ping_exporter_config.yml.j2'
|
||||||
dest: "{{ ping_exporter__user_home }}/ping_exporter_config.yml"
|
dest: "{{ ping_exporter__user_home }}/ping_exporter_config.yml"
|
||||||
mode: 0640
|
mode: 0640
|
||||||
owner: "{{ ping_exporter__user }}"
|
owner: "{{ ping_exporter__user }}"
|
||||||
|
|
|
@ -14,3 +14,6 @@
|
||||||
|
|
||||||
- name: Configurel ping exporter
|
- name: Configurel ping exporter
|
||||||
ansible.builtin.include_tasks: config.yml
|
ansible.builtin.include_tasks: config.yml
|
||||||
|
|
||||||
|
- name: Start systemd unit
|
||||||
|
ansible.builtin.include_tasks: systemd.yml
|
||||||
|
|
18
tasks/systemd.yml
Normal file
18
tasks/systemd.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
- name: "Setup systemd service"
|
||||||
|
become: true
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: 'templates/ping_exporter.service.j2'
|
||||||
|
dest: '/lib/systemd/system/ping_exporter.service'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
notify:
|
||||||
|
- "Systemctl restart ping_exporter.service"
|
||||||
|
|
||||||
|
- name: "Reload systemd"
|
||||||
|
become: true
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
daemon_reload: true
|
||||||
|
notify:
|
||||||
|
- "Systemctl restart ping_exporter.service"
|
11
templates/ping_exporter.service.j2
Normal file
11
templates/ping_exporter.service.j2
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Execute the ping_exporter server.
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
WorkingDirectory={{ ping_exporter__user_home }}
|
||||||
|
ExecStart=/usr/bin/ping_exporter --config.path {{ ping_exporter__user_home }}/ping_exporter_config.yml
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -3,5 +3,5 @@ ping_exporter__repo: 'https://github.com/czerwonk/ping_exporter.git'
|
||||||
ping_exporter__repo_api: 'https://api.github.com/repos/czerwonk/ping_exporter/releases/latest'
|
ping_exporter__repo_api: 'https://api.github.com/repos/czerwonk/ping_exporter/releases/latest'
|
||||||
|
|
||||||
# versionscheck
|
# versionscheck
|
||||||
playbook_version_number: 02 # should be a integer
|
playbook_version_number: 03 # should be a integer
|
||||||
playbook_version_path: 'do1jlr.prometheus_ping_exporter.version'
|
playbook_version_path: 'do1jlr.prometheus_ping_exporter.version'
|
||||||
|
|
Loading…
Reference in a new issue