ansible-role-server/tasks/telegraf-Debian.yml

48 lines
1.3 KiB
YAML

---
# Server/Telegraf: Install and Setup Telegraf Monitoring - Debian Version
- name: Telegraf - Install apt-transport-https
become: true
ansible.builtin.apt:
name: apt-transport-https
state: present
diff: false
- name: Telegraf - Add telegraf repo key
become: true
ansible.builtin.apt_key:
url: https://repos.influxdata.com/influxdata-archive_compat.key
state: present
- name: Telegraf - Add telegraf repo
become: true
when: ansible_distribution_release != 'bookworm'
ansible.builtin.apt_repository:
repo: "deb https://repos.influxdata.com/debian {{ ansible_distribution_release }} stable"
state: present
- name: Telegraf - Add telegraf repo
when: ansible_distribution_release == 'bookworm'
become: true
ansible.builtin.apt_repository:
repo: "deb https://repos.influxdata.com/debian bullseye stable"
state: present
- name: Telegraf - Install telegraf
become: true
ansible.builtin.apt:
name: telegraf
state: latest
update_cache: true
cache_valid_time: 3600
diff: false
# Install SNMP utilities for telegraf monitoring
- name: Telegraf - Install SNMP utilities
when: telegraf_ubnt_ns_ips is defined
become: true
ansible.builtin.apt:
name: "{{ packages }}"
state: present
vars:
packages:
- snmp
- snmp-mibs-downloader
diff: false