This role installs and configures Telegraf.
Ansible 2.10 or newer.
- Debian - 11 (Bullseye)
- Debian - 12 (Bookworm)
- Ubuntu - 20.04 (Focal Fossa)
- Ubuntu - 22.04 (Jammy Jellyfish)
Variable | Required | Default | Choices | Comments |
---|---|---|---|---|
telegraf_dependencies | yes | [apt-transport-https,gnupg] |
list | |
telegraf_package_state | yes | true |
bool | Use latest to upgrade. |
telegraf_config_path | yes | /etc/telegraf |
string | |
telegraf_global_tags | yes | {} |
dict | |
telegraf_agent_interval | yes | 10s |
string | |
telegraf_agent_round_interval | yes | true |
bool | |
telegraf_agent_metric_batch_size | yes | 1000 |
int | |
telegraf_agent_metric_buffer_limit | yes | 10000 |
int | |
telegraf_agent_collection_jitter | yes | 0s |
string | |
telegraf_agent_flush_interval | yes | 10s |
string | |
telegraf_agent_flush_jitter | yes | 0s |
string | |
telegraf_agent_precision | yes | `` | string | |
telegraf_agent_debug | yes | false |
bool | |
telegraf_agent_quiet | yes | false |
bool | |
telegraf_agent_logtarget | yes | file |
string | |
telegraf_agent_logfile | yes | `` | string | |
telegraf_agent_logfile_rotation_interval | yes | 0d |
string | |
telegraf_agent_logfile_rotation_max_size | yes | 0MB |
string | |
telegraf_agent_logfile_rotation_max_archives | yes | 5 |
int | |
telegraf_agent_log_with_timezone | yes | `` | string | |
telegraf_agent_hostname | yes | `` | string | |
telegraf_agent_omit_hostname | yes | false |
bool | |
telegraf_outputs | yes | [] |
list | See defaults/main.yml . |
telegraf_inputs | yes | [] |
list | See defaults/main.yml . |
None
- hosts: all
roles:
- role: ansible-role-telegraf
telegraf_outputs:
- name: influxdb_v2
config:
- urls = ["unix:///var/run/influxdb.sock"]
- token = "abcd1234"
- organization = "MyOrg"
- bucket = "telegraf"
telegraf_inputs:
- name: cpu
config:
- percpu = false
tags:
- tag1 = "foo"
- tag2 = "bar"
- name: disk
config:
- mount_points = ["/", "/data"]
- name: cloudwatch
config:
- tagexclude = ["region", "instance_id"]
- region = "us-east-1"
- access_key = "ACCESS_KEY"
- secret_key = "SECRET_KEY"
- period = "5m"
- delay = "5m"
- interval = "5m"
- namespaces = ["AWS/EC2"]
- metrics:
config:
- names = ["CPUCreditBalance"]
- dimensions:
config:
- name = "InstanceId"
- value = "i-1234"
molecule test
MIT