Skip to content

Commit

Permalink
Merge pull request #101 from dj-wasabi/minor-changes-for-freebsd
Browse files Browse the repository at this point in the history
Some changes for fixing FreeBSD
  • Loading branch information
Werner Dijkerman authored Apr 27, 2019
2 parents f843a3f + 3fdba74 commit 852cfaa
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 122 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ Design goals are to have a minimal memory footprint with a plugin system so that
## Requirements

### Supported systems

This role supports the following systems:

* Red Hat
* Debian
* Ubuntu
* Docker container
* Windows (Best effort)
* (Open)Suse
* Windows (Best effort)
* FreeBSD (Best effort)

So, you'll need one of those systems.. :-)
Please sent Pull Requests or suggestions when you want to use this role for other systems.
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ telegraf_agent_flush_interval: 10
telegraf_agent_flush_jitter: 0
telegraf_agent_aws_tags: False
telegraf_agent_aws_tags_prefix: ""
telegraf_agent_config_path: /etc/telegraf

# Docker specific settings
telegraf_uid_docker: 998
Expand Down
4 changes: 4 additions & 0 deletions tasks/FreeBSD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

- name: "FreeBSD | add telegraf_flags for extra plugins"
shell: sysrc telegraf_flags="-quiet -config-directory=/usr/local/etc/telegraf.d"
tags:
- skip_ansible_lint

- name: "FreeBSD | add telegraf to init"
shell: sysrc telegraf_enable="YES"
tags:
- skip_ansible_lint
110 changes: 0 additions & 110 deletions tasks/configure_FreeBSD.yml

This file was deleted.

18 changes: 12 additions & 6 deletions tasks/configure_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
when:
- telegraf_agent_aws_tags

- name: "Add prefix path"
set_fact:
telegraf_agent_config_path: /usr/local/etc/telegraf
when:
- ansible_os_family == "FreeBSD"

- name: Retrieve all ec2 tags on the instance
ec2_tag:
region: '{{ ansible_ec2_placement_region }}'
Expand All @@ -32,7 +38,7 @@
- name: "Copy the template for versions >= 0.10.0"
template:
src: telegraf.conf.j2
dest: /etc/telegraf/telegraf.conf
dest: "{{ telegraf_agent_config_path }}/telegraf.conf"
owner: telegraf
group: telegraf
mode: 0640
Expand All @@ -45,15 +51,15 @@

- name: "Check if extra plugins directory exists in case of exclusive"
stat:
path: /etc/telegraf/telegraf.d
path: "{{ telegraf_agent_config_path }}/telegraf.d"
register: telegraf_directory
when:
- telegraf_plugins_extra_exclusive

- name: "Delete telegraf extra plugin path"
file:
state: absent
path: "/etc/telegraf/telegraf.d/"
path: "{{ telegraf_agent_config_path }}/telegraf.d/"
when:
- telegraf_plugins_extra_exclusive
- telegraf_directory.stat.exists
Expand All @@ -65,7 +71,7 @@
- name: "Create telegraf extra plugin path"
file:
state: directory
path: "/etc/telegraf/telegraf.d/"
path: "{{ telegraf_agent_config_path }}/telegraf.d/"
owner: telegraf
group: telegraf
mode: 0755
Expand All @@ -80,7 +86,7 @@
- name: "Copy telegraf extra plugins"
template:
src: "telegraf-extra-plugin.conf.j2"
dest: "/etc/telegraf/telegraf.d/{{ item.key }}.conf"
dest: "{{ telegraf_agent_config_path }}/telegraf.d/{{ item.key }}.conf"
owner: telegraf
group: telegraf
mode: 0640
Expand All @@ -98,7 +104,7 @@

- name: "Remove telegraf extra plugins"
file:
path: "/etc/telegraf/telegraf.d/{{ item.key }}.conf"
path: "{{ telegraf_agent_config_path }}/telegraf.d/{{ item.key }}.conf"
state: absent
with_dict: "{{ telegraf_plugins_extra }}"
loop_control:
Expand Down
5 changes: 0 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@
- include_tasks: "docker.yml"
when: telegraf_agent_docker

- name: "Configure Telegraf"
include_tasks: "configure_FreeBSD.yml"
when:
- ansible_os_family == "FreeBSD"

- name: "Configure Telegraf"
include_tasks: "configure_linux.yml"
when:
Expand Down

0 comments on commit 852cfaa

Please sign in to comment.