mirror of
https://github.com/prometheus-community/ansible
synced 2024-12-13 13:52:31 +00:00
1d98aee69a
Signed-off-by: SuperQ <superq@gmail.com>
38 lines
1.1 KiB
YAML
38 lines
1.1 KiB
YAML
---
|
|
- name: Copy the SNMP Exporter systemd service file
|
|
ansible.builtin.template:
|
|
src: snmp_exporter.service.j2
|
|
dest: /etc/systemd/system/snmp_exporter.service
|
|
owner: root
|
|
ansible.builtin.group: root
|
|
mode: 0644
|
|
notify:
|
|
- restart snmp exporter
|
|
|
|
- name: Download snmp configuration file from github repository
|
|
ansible.builtin.get_url:
|
|
url: "https://raw.githubusercontent.com/prometheus/snmp_exporter/v{{ snmp_exporter_version }}/snmp.yml"
|
|
dest: /etc/snmp_exporter/snmp.yml
|
|
validate_certs: false
|
|
owner: root
|
|
ansible.builtin.group: root
|
|
mode: 0644
|
|
register: _download_config
|
|
until: _download_config is success
|
|
retries: 5
|
|
delay: 2
|
|
notify:
|
|
- reload snmp exporter
|
|
when: snmp_exporter_config_file == ""
|
|
|
|
- name: Copy configuration file
|
|
ansible.builtin.template:
|
|
src: "{{ snmp_exporter_config_file }}"
|
|
dest: /etc/snmp_exporter/snmp.yml
|
|
owner: root
|
|
ansible.builtin.group: root
|
|
mode: 0644
|
|
no_log: "{{ 'true' if __testing_on_travis is defined else 'false' }}"
|
|
notify:
|
|
- reload snmp exporter
|
|
when: snmp_exporter_config_file != ""
|