ansible-collection-prometheus/roles/snmp_exporter/tasks/install.yml

41 lines
1.5 KiB
YAML
Raw Normal View History

---
- 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
ansible.builtin.group: root
mode: 0755