rossmcdonald / telegraf

Ansible role for installing, configuring, and maintaining Telegraf
138 stars 85 forks source link

Module throws errors when running ansible-playbook with -C #50

Open johnrmiller opened 5 years ago

johnrmiller commented 5 years ago

Getting errors when running ansible-playbook with -C:

RUNNING HANDLER [rossmcdonald.telegraf : assert running] *****************************************************************************************
fatal: [my.host.name]: FAILED! => {"msg": "The conditional check 'telegraf_service_status.rc == 0' failed. The error was: error while evaluating conditional (telegraf_service_status.rc == 0): 'dict object' has no attribute 'rc'"}

When running with -C, ansible-playbook doesn't execute command resources; therefore telegraf_service_status doesn't get set and the check fails. This precludes this role from being run in an automated fashion; for example via a cron or Jenkins job.

Role should probably be changed instead to use a service resource rather than trying to call the service command (which doesn't exist for all systems) directly.