-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanu-telegraf.yml
52 lines (45 loc) · 1.26 KB
/
anu-telegraf.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
- name: Install and configure telegraf client
hosts: "{{ variable_host | default('anu-local') }}"
become: yes
vars_files:
- vars/default.yml
tasks:
- name: Install dependencies
apt:
pkg:
- apt-transport-https
update_cache: yes
environment:
DEBIAN_FRONTEND: noninteractive
- name: Telegraf repository key
apt_key:
url: https://repos.influxdata.com/influxdb.key
keyring: /etc/apt/trusted.gpg.d/telegraf.gpg
state: present
- name: Telegraf repository
apt_repository:
repo: "deb https://repos.influxdata.com/ubuntu {{ ansible_distribution_release }} stable"
state: present
filename: telegraf
register: repo_telegraf
- name: Update cache
apt:
update_cache: yes
when: repo_telegraf.changed
- name: Telegraf packages
apt:
name:
- telegraf
state: present
register: install_telegraf
- name: Template configfile
template:
src: templates/telegraf/telegraf.conf.j2
dest: /etc/telegraf/telegraf.conf
- name: Enable and start Telegraf service
service:
name: telegraf
state: started
enabled: yes
register: start_telegraf