Files
ansible-telegraf/tasks/Debian.yml
2018-05-19 21:14:11 +02:00

43 lines
1.1 KiB
YAML

---
- name: Ensure the system can use the HTTPS transport for APT.
stat:
path: /usr/lib/apt/methods/https
register: apt_https_transport
- name: Install APT HTTPS transport.
apt:
name: "apt-transport-https"
state: present
when: not apt_https_transport.stat.exists
become: yes
- name: Download Telegraf apt key.
apt_key:
url: "https://repos.influxdata.com/influxdb.key"
state: present
become: yes
- name: Add Telegraf repository (using LSB).
apt_repository:
repo: "deb https://repos.influxdata.com/{{ ansible_distribution|lower }} {{ ansible_lsb.codename }} stable"
filename: "telegraf"
state: present
become: yes
when: ansible_lsb is defined and ansible_lsb.codename is defined
- name: Add Telegraf repository.
apt_repository:
repo: "deb https://repos.influxdata.com/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
filename: "telegraf"
state: present
become: yes
when: ansible_lsb is not defined or ansible_lsb.codename is not defined
- name: "Install telegraf package | Debian"
apt:
name: "telegraf"
state: present
notify: "Restart Telegraf"
become: yes