ansible-collection-prometheus/roles/snmp_exporter/tasks/install.yml
gardar 1b3f19e2be
fix: avoid spaces when doing line breaks on long urls
Signed-off-by: gardar <gardar@users.noreply.github.com>
2023-01-11 18:58:59 +00:00

40 lines
1.4 KiB
YAML

---
- name: Download snmp_exporter binary to local folder
become: false
ansible.builtin.get_url:
url: "https://github.com/prometheus/snmp_exporter/releases/download/v{{ snmp_exporter_version }}/\
snmp_exporter-{{ snmp_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz"
dest: "/tmp"
checksum: "sha256:{{ snmp_exporter_checksum }}"
mode: 0644
register: _download_binary
until: _download_binary is success
retries: 5
delay: 2
delegate_to: localhost
check_mode: false
- name: Unpack snmp_exporter binary
become: false
ansible.builtin.unarchive:
src: "/tmp/snmp_exporter-{{ snmp_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz"
dest: "/tmp"
creates: "/tmp/snmp_exporter-{{ snmp_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/snmp_exporter"
delegate_to: localhost
check_mode: false
- name: Propagate SNMP Exporter binaries
ansible.builtin.copy:
src: "/tmp/snmp_exporter-{{ snmp_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/snmp_exporter"
dest: "/usr/local/bin/snmp_exporter"
mode: 0755
notify:
- restart snmp exporter
- name: Create configuration directory
ansible.builtin.file:
path: "/etc/snmp_exporter"
state: directory
owner: root
group: root
mode: 0755