2019-10-06 20:55:56 +00:00
|
|
|
---
|
|
|
|
# Server/Telegraf: Install and Setup Telegraf Monitoring
|
|
|
|
|
2020-03-08 15:41:55 +00:00
|
|
|
# Install
|
2019-10-06 20:55:56 +00:00
|
|
|
- name: telegraf - Install telegraf
|
2020-03-08 15:41:55 +00:00
|
|
|
include_tasks: "{{ item }}"
|
|
|
|
with_first_found:
|
|
|
|
- "telegraf-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
|
|
|
|
- "telegraf-{{ ansible_distribution }}.yml"
|
2020-03-08 16:56:50 +00:00
|
|
|
- "telegraf-{{ (override_os_family is defined) | ternary(override_os_family,ansible_os_family) }}.yml"
|
2019-10-06 20:55:56 +00:00
|
|
|
|
2020-05-22 11:18:45 +00:00
|
|
|
# Install SNMP MIBs
|
|
|
|
- name: telegraf - Install SNMP MIBs
|
|
|
|
become: yes
|
|
|
|
block:
|
|
|
|
- name: SNMP - Download and install Ubiquiti MIB
|
|
|
|
copy:
|
|
|
|
src: "{{ role_path }}/files/UBNT-MIB.txt"
|
|
|
|
dest: /usr/share/snmp/mibs/UBNT-MIB
|
|
|
|
- name: SNMP - Download and install Ubiquiti MIB
|
|
|
|
copy:
|
|
|
|
src: "{{ role_path }}/files/UBNT-AirMAX-MIB.txt"
|
|
|
|
dest: /usr/share/snmp/mibs/UBNT-AirMAX-MIB
|
|
|
|
- name: SNMP - Download and install UniFi MIB
|
|
|
|
copy:
|
|
|
|
src: "{{ role_path }}/files/UBNT-UniFi-MIB.txt"
|
|
|
|
dest: /usr/share/snmp/mibs/UBNT-UniFi-MIB
|
|
|
|
- name: SNMP - Setup snmp.conf
|
|
|
|
lineinfile:
|
|
|
|
name: /etc/snmp/snmp.conf
|
|
|
|
line: mibs +ALL
|
|
|
|
create: yes
|
|
|
|
when: telegraf_ubnt_ns_ips is defined
|
|
|
|
|
2020-03-08 15:41:55 +00:00
|
|
|
# Configure
|
2019-10-06 20:55:56 +00:00
|
|
|
- name: telegraf - Copy telegraf config
|
|
|
|
become: yes
|
|
|
|
template:
|
2020-05-22 11:18:45 +00:00
|
|
|
src: "{{ role_path }}/templates/telegraf.conf.j2"
|
2019-10-06 20:55:56 +00:00
|
|
|
dest: /etc/telegraf/telegraf.conf
|
|
|
|
notify:
|
2019-11-12 20:34:35 +00:00
|
|
|
- Enable and restart telegraf
|