jitsi-quick/roles/telegraf/tasks/debian.yml

72 行
2.1 KiB
YAML

- name: Install telegraf prerequsistes
apt:
pkg:
- apt-transport-https
- curl
- gnupg2
- name: Add influx repo key
shell: curl -sL https://repos.influxdata.com/influxdb.key | apt-key add -
#- name: Check system version
# shell: source /etc/os-release
# args:
# executable: /bin/bash
#
#- set_fact: VERSION_ID="{{ lookup('env','VERSION_ID') }}"
- name: memorize debian version variable
shell: cat /etc/debian_version | cut -d. -f1
register: debian_version
- set_fact:
debian_version={{ debian_version.stdout }}
- name: add repo for debian 7
when: "{{ debian_version }} == 7"
shell: echo "deb https://repos.influxdata.com/debian wheezy stable" | tee /etc/apt/sources.list.d/influxdb.list
- name: add repo for debian 8
when: "{{ debian_version }} == 8"
shell: echo "deb https://repos.influxdata.com/debian jessie stable" | tee /etc/apt/sources.list.d/influxdb.list
- name: add repo for debian 9
when: "{{ debian_version }} == 9"
shell: echo "deb https://repos.influxdata.com/debian stretch stable" | tee /etc/apt/sources.list.d/influxdb.list
- name: add repo for debian 10
when: "{{ debian_version }} == 10"
shell: echo "deb https://repos.influxdata.com/debian $(lsb_release -cs) stable"|sudo tee /etc/apt/sources.list.d/influxdb.list
- name: add repo for debian 11
when: "{{ debian_version }} == 11"
shell: echo "deb https://repos.influxdata.com/debian $(lsb_release -cs) stable"|sudo tee /etc/apt/sources.list.d/influxdb.list
- name: Update repositories cache
apt:
update_cache: yes
- name: telegraf
apt:
pkg:
- telegraf
#- name: create telegraf basic config
# shell: telegraf -sample-config -input-filter cpu:mem:swap:net:netstat:disk:diskio:docker:system:processes:kernel:sysstat:conntrack:nstat:iptables:sensors -output-filter influxdb > /etc/telegraf/telegraf.conf
- name: restart telegraf
systemd:
state: restarted
name: telegraf
- name: restart telegraf
systemd:
enabled: yes
name: telegraf
#- name: display help next steps
# vars:
# contents: "{{ lookup('file', 'repo/telegraf_settings') }}"
# debug: msg="{{ contents.split('\n') }}"