entercloudsuite.ansible_telegraf
Ansible Role: telegraf
Installs telegraf on Ubuntu 16.04 (Xenial)
Requirements
This role requires Ansible 2.4 or higher. This role is a copy of dj-wasabi.telegraf
Role Variables
Check the role doc https://github.com/dj-wasabi/ansible-telegraf/blob/master/README.md
Example Playbook
Run with default vars:
- hosts: all
roles:
- { role: ansible-telegraf }
Example.2 Playbook
---
- name: run the main role
hosts: all
become_method: su
roles:
- role: dj-wasabi.telegraf
telegraf_global_tags:
- tag_name: web
tag_value: web_server
- tag_name: environment
tag_value: production
telegraf_agent_output:
- type: influxdb
config:
- urls = ["http://localhost:8086"]
- timeout = "5s"
- database = "mydatabases"
- username = "myusername"
- password = "verySecret"
telegraf_plugins_default:
- plugin: cpu
config:
- percpu = true
- totalcpu = true
- collect_cpu_time = false
- plugin: disk
config:
- ignore_fs = ["tmpfs", "devtmpfs"]
- plugin: io
- plugin: mem
- plugin: net
- plugin: system
- plugin: swap
- plugin: netstat
- plugin: processes
- plugin: kernel
- plugin: sysstat
config:
- interval = "60s"
- sadc_path = "/usr/lib/sysstat/sadc"
telegraf_plugins_extra:
mysql:
config:
- servers = ["root:v3ryS3cr3t@tcp(localhost:3306)/"]
memcached:
config:
- servers = ["localhost:11211"]
postgresql:
config:
- address = "postgres://telegraf:verysecret_Password@localhost/db"
Testing
Tests are performed using Molecule.
Install Molecule or use docker-compose run --rm molecule to run a local Docker container, based on the enterclousuite/molecule project, from where you can use molecule.
- Run
molecule createto start the target Docker container on your local engine. - Use
molecule loginto log in to the running container. - Edit the role files.
- Add other required roles (external) in the molecule/default/requirements.yml file.
- Edit the molecule/default/playbook.yml.
- Define infra tests under the molecule/default/tests folder using the goos verifier.
- When ready, use
molecule convergeto run the Ansible Playbook andmolecule verifyto execute the test suite.
Note that the converge process starts performing a syntax check of the role.
Destroy the Docker container with the commandmolecule destroy.
To run all the steps with just one command, run molecule test.
In order to run the role targeting a VM, use the playbook_deploy.yml file for example with the following command: ansible-playbook ansible-telegraf/molecule/default/playbook_deploy.yml -i VM_IP_OR_FQDN, -u ubuntu --private-key private.pem.
License
MIT
Install
ansible-galaxy install entercloudsuite.ansible_telegrafLicense
mit
Downloads
79
Owner
