Add system package and sysctl configuration

This commit is contained in:
Antonio J. Delgado 2023-11-01 15:57:13 +02:00
parent 866c61890c
commit 9e6d7f970a
2 changed files with 18 additions and 1 deletions

View file

@ -1,26 +1,38 @@
---
- name: Ensure all groups can do ping
ansible.posix.sysctl:
name: net.ipv4.ping_group_range
value: '0 2147483647'
sysctl_set: true
state: present
reload: true
- name: Ensure ping_exporter is configured
template:
dest: /etc/ping_exporter.conf
src: templates/ping_exporter.conf.j2
backup: yes
notify: Restart ping_exporter service
- name: Ensure ping_exporter systemd unit is installed
template:
dest: /etc/systemd/system/ping_exporter.service
src: templates/ping_exporter.service.j2
backup: yes
- name: Ensure ping_exporter service is enabled and running
systemd:
name: ping_exporter.service
state: started
enabled: yes
- name: Ensure Prometheus host can reach ping_exporter
ufw:
rule: allow
port: "{{ ping_exporter['port'] }}"
src: "{{ ping_exporter['prometheus_host'] }}"
when: ping_exporter['handle_ufw']
- name: Ensure there is a logrotate rule for ping_exporter
template:
dest: /etc/logrotate.d/ping_exporter

View file

@ -5,6 +5,11 @@
dest: /var/lib/from_repos/ping_exporter
depth: 1
notify: Restart ping_exporter service
- name: Install system packages
ansible.builtin.package:
name: python3-icmplib
- name: Install ping_exporter python requirements
pip:
requirements: /var/lib/from_repos/ping_exporter/requirements.txt