mirror of
https://github.com/roles-ansible/ansible_role_prometheus_ping_exporter.git
synced 2024-08-16 10:19:51 +02:00
config ping exporter
This commit is contained in:
parent
c71c6fb17d
commit
9c85eef92a
5 changed files with 55 additions and 0 deletions
|
@ -8,5 +8,9 @@ ping_exporter__shell: '/bin/false'
|
||||||
# Version
|
# Version
|
||||||
ping_exporter__version: 'latest'
|
ping_exporter__version: 'latest'
|
||||||
|
|
||||||
|
# config
|
||||||
|
ping_exporter__targets: []
|
||||||
|
ping_exporter__nameserver: '9.9.9.9'
|
||||||
|
|
||||||
# should we do a version check? (recomended)
|
# should we do a version check? (recomended)
|
||||||
submodules_versioncheck: false
|
submodules_versioncheck: false
|
||||||
|
|
9
tasks/config.yml
Normal file
9
tasks/config.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
- name: Create ping exporter config
|
||||||
|
become: true
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: 'templates/ping_exporter_config.yml'
|
||||||
|
dest: "{{ ping_exporter__user_home }}/ping_exporter_config.yml"
|
||||||
|
mode: 0640
|
||||||
|
owner: "{{ ping_exporter__user }}"
|
||||||
|
group: "{{ ping_exporter__group }}"
|
18
tasks/install.yml
Normal file
18
tasks/install.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
- name: Update apt cache
|
||||||
|
become: true
|
||||||
|
ansible.builtin.apt:
|
||||||
|
cache_valid_time: 3600
|
||||||
|
update_cache: true
|
||||||
|
when:
|
||||||
|
- ansible_pkg_mgr == "apt"
|
||||||
|
|
||||||
|
- name: Install ping_exporter binary
|
||||||
|
become: true
|
||||||
|
ansible.builtin.apt:
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
|
deb: "https://github.com/czerwonk/ping_exporter/releases/download/{{ ping_exporter_version_target }}/ping_exporter_{{ ping_exporter_version_target }}_linux_amd64.deb"
|
||||||
|
when:
|
||||||
|
- ansible_pkg_mgr == "apt"
|
||||||
|
|
||||||
|
# TODO: Multi OS support and verify download
|
|
@ -8,3 +8,9 @@
|
||||||
|
|
||||||
- name: Get latest release and define version
|
- name: Get latest release and define version
|
||||||
ansible.builtin.include_tasks: set_version.yml
|
ansible.builtin.include_tasks: set_version.yml
|
||||||
|
|
||||||
|
- name: Install ping exporter
|
||||||
|
ansible.builtin.include_tasks: install.yml
|
||||||
|
|
||||||
|
- name: Configurel ping exporter
|
||||||
|
ansible.builtin.include_tasks: config.yml
|
||||||
|
|
18
templates/ping_exporter_config.yml
Normal file
18
templates/ping_exporter_config.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
#
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
#
|
||||||
|
targets: {{ping_exporter__targets}}
|
||||||
|
|
||||||
|
dns:
|
||||||
|
refresh: 2m15s
|
||||||
|
nameserver: {{ping_exporter__nameserver}}
|
||||||
|
|
||||||
|
ping:
|
||||||
|
interval: 2s
|
||||||
|
timeout: 3s
|
||||||
|
history-size: 42
|
||||||
|
payload-size: 120
|
||||||
|
|
||||||
|
options:
|
||||||
|
disableIPv6: false
|
Loading…
Reference in a new issue