2020-08-30 19:35:18 -05:00
|
|
|
#!/usr/bin/ansible-playbook
|
|
|
|
# vim:ft=ansible:
|
|
|
|
---
|
|
|
|
- name: Install and configure Telegraf
|
|
|
|
block:
|
|
|
|
- name: Add repo keys by URL
|
|
|
|
apt_key:
|
|
|
|
url: "{{ item }}"
|
|
|
|
loop:
|
|
|
|
- "https://repos.influxdata.com/influxdb.key"
|
|
|
|
- name: Add repos
|
|
|
|
apt_repository:
|
|
|
|
repo: "{{ item }}"
|
|
|
|
loop:
|
|
|
|
- "deb https://repos.influxdata.com/ubuntu {{ ansible_distribution_release }} stable"
|
|
|
|
- name: Install Telegraf
|
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- telegraf
|
2020-08-31 21:02:12 -05:00
|
|
|
- name: Copy configs
|
|
|
|
template:
|
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "/etc/telegraf/telegraf.d/{{ item.dest }}"
|
|
|
|
mode: "0644"
|
|
|
|
loop:
|
|
|
|
- { src: "50-ansible.conf", dest: "50-ansible.conf" }
|
|
|
|
notify: restart telegraf
|
2020-08-30 19:35:18 -05:00
|
|
|
become: yes
|