Add FreeBSD support

This commit is contained in:
Jannik Beyerstedt 2021-05-02 18:19:11 +02:00
parent 39045ed5a0
commit 22dd9bfb3d
6 changed files with 60 additions and 21 deletions

View file

@ -8,6 +8,7 @@
- "cronmails-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
- "cronmails-{{ ansible_distribution }}.yml"
- "cronmails-{{ (override_os_family is defined) | ternary(override_os_family,ansible_os_family) }}.yml"
ignore_errors: true
# Set cronjob env variables/ settings
- name: cronmails - Crontab set path

View file

@ -0,0 +1,31 @@
---
# Server/Telegraf: Install and Setup Telegraf Monitoring - FreeBSD Version
- name: telegraf - Install telegraf
become: yes
ansible.builtin.package:
name: telegraf
state: latest
# # Install SNMP utilities for telegraf monitoring
# - name: telegraf - Install SNMP utilities
# become: yes
# ansible.builtin.package:
# name: "{{ packages }}"
# state: present
# vars:
# packages:
# - snmp
# - snmp-mibs-downloader
# when: telegraf_ubnt_ns_ips is defined
- name: telegraf - Install SNMP utilities
become: yes
ansible.builtin.package:
name: "{{ packages }}"
state: present
vars:
packages:
- snmp
- snmp-mibs-downloader
when: telegraf_ubnt_ns_ips is defined

View file

@ -33,10 +33,23 @@
when: telegraf_ubnt_ns_ips is defined
# Configure
- name: telegraf - Copy telegraf config
- name: telegraf - Copy telegraf config (Linux)
become: yes
template:
src: "{{ role_path }}/templates/telegraf.conf.j2"
dest: /etc/telegraf/telegraf.conf
notify:
- Enable and restart telegraf
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) != "FreeBSD"
- name: telegraf - Copy telegraf config (FreeBSD)
become: yes
template:
src: "{{ role_path }}/templates/telegraf.conf.j2"
dest: /usr/local/etc/telegraf.conf
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "FreeBSD"
- name: telegraf - Enable and restart telegraf
become: yes
service:
name: telegraf
state: restarted
enabled: yes