ansible-role-telegraf/tasks/main.yml

51 lines
1.1 KiB
YAML

---
- name: install depencies packages
ansible.builtin.package:
name:
- apt-transport-https
- gpg
tags: telegraf
- name: add key for influx repository
ansible.builtin.apt_key:
url: https://repos.influxdata.com/influxdb.key
tags: telegraf
- name: add influx repository
ansible.builtin.apt_repository:
filename: influx
repo: 'deb https://repos.influxdata.com/debian {{ ansible_distribution_release }} stable'
tags: telegraf
- name: install influxdb package
ansible.builtin.package:
name:
- telegraf
tags: telegraf
- name: copy default variables file
ansible.builtin.template:
src: default.j2
dest: /etc/default/telegraf
owner: root
group: root
mode: 0644
notify: restart telegraf
tags: telegraf
- name: copy config file
ansible.builtin.template:
src: telegraf.conf.j2
dest: /etc/telegraf/telegraf.conf
owner: root
group: telegraf
mode: 0640
notify: restart telegraf
tags: telegraf
- name: start and enable service
ansible.builtin.service:
name: telegraf
state: started
enabled: true
tags: telegraf