Skip to content

Commit

Permalink
Merge pull request #126 from carlba/plugin-dependencies
Browse files Browse the repository at this point in the history
Plugin dependencies are installed and configured
  • Loading branch information
dj-wasabi committed Jun 14, 2020
2 parents 9353a54 + 4b10834 commit 08b1c62
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions tasks/configure_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,61 @@
enabled: yes
become: yes
when: not telegraf_agent_docker

- name: Configure system for for docker plugin
block:
- name: Add telegraf user to docker group
user:
name: telegraf
groups: docker
append: true
become: true
notify:
- Restart Telegraf

when: "'docker' in telegraf_plugins_extra and not telegraf_agent_docker"

- name: Configure system for for smart plugin
block:
- name: Install smartmontools
become: true
package:
name: smartmontools

- name: Find path of smartctl
shell: which smartctl
register: which_smartctl
ignore_errors: true
changed_when: false
become: true

- name: Ensure telegraf user can execute smartctl
blockinfile:
marker: "# {mark} ANSIBLE MANAGED BLOCK (Ensure telegraf user can execute smartctl)"
dest: "/etc/sudoers.d/telegraf"
block: "telegraf ALL=(root) NOPASSWD: {{ which_smartctl.stdout }}"
create: true
become: true
notify:
- Restart Telegraf

when: "'smart' in telegraf_plugins_extra and not telegraf_agent_docker"

- name: Configure system for for sensors plugin
block:
- name: Debian | Install lm-sensors
package:
name: lm-sensors
become: true
notify:
- Restart Telegraf
when: ansible_os_family == "Debian"
- name: RedHat | Install lm-sensors
package:
name: lm_sensors
become: true
notify:
- Restart Telegraf
when: ansible_os_family == "RedHat"

when: "'sensors' in telegraf_plugins_extra and not telegraf_agent_docker"

0 comments on commit 08b1c62

Please sign in to comment.