[CODE] add CentOS support to telegraf and cronmails (fix #6)

This commit is contained in:
Jannik Beyerstedt 2020-03-08 16:41:55 +01:00
parent cb289b8fb5
commit 71b3e80227
7 changed files with 88 additions and 30 deletions

View file

@ -10,6 +10,10 @@ galaxy_info:
- name: Debian
versions:
- all
- name: Centos
versions:
- 7
- 8
galaxy_tags:
[]

View file

@ -0,0 +1,13 @@
---
# Server/Cronmails: Setup Mails from Cronjobs (install exim) - CentOS Version
# Install exim
- name: cronmails - Install exim4 as MTA
become: yes
yum:
name: "{{ packages }}"
state: present
vars:
packages:
- exim4
- mailutils

View file

@ -0,0 +1,13 @@
---
# Server/Cronmails: Setup Mails from Cronjobs (install exim) - Debian Version
# Install exim
- name: cronmails - Install exim4 as MTA
become: yes
apt:
name: "{{ packages }}"
state: present
vars:
packages:
- exim4
- mailutils

View file

@ -2,15 +2,14 @@
# Server/Cronmails: Setup Mails from Cronjobs (install exim)
# Install and configure exim
- name: cronmails - Install exim4 as MTA
become: yes
apt:
name: "{{ packages }}"
state: present
vars:
packages:
- exim4
- mailutils
- name: cronmails - Install exim4
include_tasks: "{{ item }}"
with_first_found:
- "cronmails-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
- "cronmails-{{ ansible_distribution }}.yml"
- "cronmails-{{ ansible_os_family }}.yml"
# Configure exim
- name: cronmails - Create exim4 config folder
become: yes
file:

18
tasks/telegraf-Centos.yml Normal file
View file

@ -0,0 +1,18 @@
---
# Server/Telegraf: Install and Setup Telegraf Monitoring - CentOS Version
- name: telegraf - Add telegraf repo
become: yes
yum_repository:
name: influxdb
description: "InfluxDB Repository - RHEL \$releasever"
baseurl: "https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable"
enabled: yes
gpgcheck: yes
gpgkey: "https://repos.influxdata.com/influxdb.key"
- name: telegraf - Install telegraf
become: yes
yum:
name: telegraf
state: latest
update_cache: yes

25
tasks/telegraf-Debian.yml Normal file
View file

@ -0,0 +1,25 @@
---
# Server/Telegraf: Install and Setup Telegraf Monitoring - Debian Version
- name: telegraf - Install apt-transport-https
become: yes
apt:
name: apt-transport-https
state: present
- name: telegraf - Add telegraf repo key
become: yes
apt_key:
url: https://repos.influxdata.com/influxdb.key
state: present
- name: telegraf - Add telegraf repo
become: yes
apt_repository:
repo: "deb https://repos.influxdata.com/debian {{ ansible_distribution_release }} stable"
state: present
- name: telegraf - Install telegraf
become: yes
apt:
name: telegraf
state: latest
update_cache: yes
cache_valid_time: 3600

View file

@ -1,29 +1,15 @@
---
# Server/Telegraf: Install and Setup Telegraf Monitoring
- name: telegraf - Install apt-transport-https
become: yes
apt:
name: apt-transport-https
state: present
- name: telegraf - Add telegraf repo key
become: yes
apt_key:
url: https://repos.influxdata.com/influxdb.key
state: present
- name: telegraf - Add telegraf repo
become: yes
apt_repository:
repo: "deb https://repos.influxdata.com/debian {{ ansible_distribution_release }} stable"
state: present
# Install
- name: telegraf - Install telegraf
become: yes
apt:
name: telegraf
state: latest
update_cache: yes
cache_valid_time: 3600
include_tasks: "{{ item }}"
with_first_found:
- "telegraf-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
- "telegraf-{{ ansible_distribution }}.yml"
- "telegraf-{{ ansible_os_family }}.yml"
# Configure
- name: telegraf - Copy telegraf config
become: yes
template: