Skip to content

Commit

Permalink
Merge pull request #9 from roles-ansible/ping
Browse files Browse the repository at this point in the history
update template and enable systemd service
  • Loading branch information
DO1JLR authored Sep 11, 2023
2 parents c364e85 + 04ec6f4 commit dc070bc
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 775 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# See https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
522 changes: 0 additions & 522 deletions .github/galaxy.svg

This file was deleted.

217 changes: 0 additions & 217 deletions .github/license.svg

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/ansible-linting-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
name: Ansible Lint check

# yamllint disable-line rule:truthy
on:
push:
branches: '*'
pull_request:
branches: '*'
on: [push, pull_request]

jobs:
build:

name: Ansible Lint
runs-on: ubuntu-latest

steps:
- name: 'checkout git repo'
uses: actions/checkout@v3
with:
lfs: true
submodules: false
fetch-depth: 0

- name: 'Lint Ansible Playbook'
uses: ansible/ansible-lint-action@v6
with:
targets: "."
path: "."
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 L3D <[email protected]>
Copyright (c) 2022-2023 L3D <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
[![License](https://raw.githubusercontent.com/roles-ansible/ansible_role_prometheus_ping_exporter/main/.github/license.svg)](https://github.com/roles-ansible/ansible_role_prometheus_ping_exporter/blob/main/LICENSE)
[![Galaxy](https://github.com/roles-ansible/ansible_role_prometheus_ping_exporter/raw/main/.github/galaxy.svg)](https://galaxy.ansible.com/do1jlr/prometheus_ping_exporter)
[![Ansible Galaxy](https://ansible.l3d.space/svg/l3d.prometheus_ping_exporter.svg)](https://galaxy.ansible.com/l3d/prometheus_ping_exporter)
[![BSD-3 Clause](https://ansible.l3d.space/svg/l3d.prometheus_ping_exporter_license.svg)](LICENSE)
[![Maintainance](https://ansible.l3d.space/svg/l3d.prometheus_ping_exporter_maintainance.svg)](https://ansible.l3d.space/#l3d.prometheus_ping_exporter)

# Ansible role prometheus ping exporter
Ansible role to install the prometheus node exporter from [github.com/czerwonk/ping_exporter](https://github.com/czerwonk/ping_exporter.git)

## Some variables
| value | default |
| --- | --- |
| ping_exporter__user | ``ping_exporter`` |
| ping_exporter__group | ``ping_exporter`` |
| ping_exporter__user_home | ``/var/lib/ping_exporter`` |
| ping_exporter__shell | ``/bin/false`` |
| ping_exporter__version | ``latest`` |
| **ping_exporter__targets** | `` []`` |
| ping_exporter__nameserver | ``9.9.9.9`` |
| ping_exporter__web_listen_address | ``:9427`` |
| ping_exporter__filename | *see defaults/main.yml* |
| submodules_versioncheck | ``false`` |
| `ping_exporter__targets` | `` []`` |
| `ping_exporter__user` | ``ping_exporter`` |
| `ping_exporter__group` | ``ping_exporter`` |
| `ping_exporter__user_home` | ``/var/lib/ping_exporter`` |
| `ping_exporter__shell` | ``/bin/false`` |
| `ping_exporter__version` | ``latest`` |
| `ping_exporter__nameserver` | ``9.9.9.9`` |
| `ping_exporter__web_listen_address` | ``:9427`` |
| `ping_exporter__filename` | *see defaults/main.yml* |
| `ping_exporter__dns` | *see defaults/main.yml* |
| `ping_exporter__ping` | *see defaults/main.yml* |
| `ping_exporter__options` | *see defaults/main.yml* |
| `submodules_versioncheck` | ``false`` |


Please define all your targets in the ``ping_exporter__targets`` array.

Expand Down
12 changes: 12 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ ping_exporter__version: 'latest'
ping_exporter__targets: []
ping_exporter__nameserver: '9.9.9.9'
ping_exporter__web_listen_address: ":9427"
ping_exporter__dns:
refresh: "2m15s"
nameserver: "{{ ping_exporter__nameserver }}"

ping_exporter__ping:
interval: "2s"
timeout: "3s"
history-size: 42
size: 120

ping_exporter__options:
disableIPv6: false

# should we do a version check? (recomended)
submodules_versioncheck: false
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
galaxy_info:
role_name: prometheus_ping_exporter
author: do1jlr
author: l3d
description: Ansible role to install a prometheus ping exporter
license: "MIT"
min_ansible_version: "2.13"
Expand Down
7 changes: 7 additions & 0 deletions tasks/systemd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@
daemon_reload: true
notify:
- "Systemctl restart ping_exporter.service"

- name: Enable ping_exporter.service Service and make sure it started
become: true
ansible.builtin.systemd:
enabled: true
name: 'ping_exporter.service'
state: 'started'
20 changes: 6 additions & 14 deletions templates/ping_exporter_config.yml.j2
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
---
#
# {{ ansible_managed }}
#
targets: {{ ping_exporter__targets }}
{{ ansible_managed | comment }}

dns:
refresh: 2m15s
nameserver: {{ ping_exporter__nameserver }}
targets: {{ ping_exporter__targets | ansible.builtin.to_yaml(encoding='utf-8') }}

ping:
interval: 2s
timeout: 3s
history-size: 42
payload-size: 120
dns: {{ ping_exporter__dns | ansible.builtin.to_yaml(encoding='utf-8') }}

options:
disableIPv6: false
ping: {{ ping_exporter__ping | ansible.builtin.to_yaml(encoding='utf-8') }}

options: {{ ping_exporter__options | ansible.builtin.to_yaml(encoding='utf-8') }}
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ ping_arch_map:
ping_arch: "{{ ping_arch_map[ansible_architecture] | default(ansible_architecture) }}"

# versionscheck
playbook_version_number: 6 # should be a integer
playbook_version_number: 8 # should be a integer
playbook_version_path: 'do1jlr.prometheus_ping_exporter.version'

0 comments on commit dc070bc

Please sign in to comment.