[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 - name: Debian
versions: versions:
- all - all
- name: Centos
versions:
- 7
- 8
galaxy_tags: 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) # Server/Cronmails: Setup Mails from Cronjobs (install exim)
# Install and configure exim # Install and configure exim
- name: cronmails - Install exim4 as MTA - name: cronmails - Install exim4
become: yes include_tasks: "{{ item }}"
apt: with_first_found:
name: "{{ packages }}" - "cronmails-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
state: present - "cronmails-{{ ansible_distribution }}.yml"
vars: - "cronmails-{{ ansible_os_family }}.yml"
packages:
- exim4 # Configure exim
- mailutils
- name: cronmails - Create exim4 config folder - name: cronmails - Create exim4 config folder
become: yes become: yes
file: 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 # Server/Telegraf: Install and Setup Telegraf Monitoring
- name: telegraf - Install apt-transport-https # Install
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 - name: telegraf - Install telegraf
become: yes include_tasks: "{{ item }}"
apt: with_first_found:
name: telegraf - "telegraf-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
state: latest - "telegraf-{{ ansible_distribution }}.yml"
update_cache: yes - "telegraf-{{ ansible_os_family }}.yml"
cache_valid_time: 3600
# Configure
- name: telegraf - Copy telegraf config - name: telegraf - Copy telegraf config
become: yes become: yes
template: template: