[DOC] update readme (fix #1), refactor
This commit is contained in:
parent
be2b9bf3c0
commit
2122e7f4eb
95
README.md
95
README.md
|
@ -1,41 +1,106 @@
|
||||||
Server
|
Server
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Essential server setup tasks, like sshd config, ddns cronjobs (+ mail output), etc.
|
Essential server setup tasks, like sshd config, ddns cronjobs (+ mail output), etc used by Jannik Beyerstedt.
|
||||||
|
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
none TODO!!
|
none
|
||||||
|
|
||||||
|
|
||||||
Role Variables
|
Role Variables
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
If borgbackup is used, the following variables need to be set for each host.
|
There are several variables, that should be set per host (e.g. in the inventory).
|
||||||
Multiple hosts using the same backup account is currently not supported by the borgbackup script.
|
|
||||||
- borgbackup_host
|
Some of the tasks listed below, will not run, if the corresponding variables are not set.
|
||||||
- borgbackup_sub
|
Therefore you can use the same playbook for multiple servers and activate the needed features with host variables.
|
||||||
|
|
||||||
|
### Borgbakup
|
||||||
|
If you want to configure borgbackup backups, these variables need to be set:
|
||||||
|
- `borgbackup_host`: Hostname used by the borgbackup script
|
||||||
|
- `borgbackup_sub`: Sub-Account ID used by the borgbackup script
|
||||||
|
|
||||||
|
Attention: You still need to setup the borgbackup repository manually.
|
||||||
|
|
||||||
|
### Telegraf
|
||||||
|
Telegraf is configured with basic host telemetry by default. You can add more features, if you like:
|
||||||
|
- `telegraf_docker`: Set to `true`, if docker telemetry should be collected
|
||||||
|
- `telegraf_snmp_fra80`: Set to `true`, if SNMP telemetry of the fra80 network should be collected
|
||||||
|
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
|
|
||||||
none
|
none
|
||||||
|
|
||||||
|
|
||||||
Example Playbook
|
Example Playbook
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
The different tasks should be used on a case-by-case basis:
|
||||||
|
```yml
|
||||||
|
- name: Common Server Configuration
|
||||||
|
hosts: servers
|
||||||
|
strategy: free
|
||||||
|
tasks:
|
||||||
|
- name: Servers - Generic setup tasks
|
||||||
|
import_role:
|
||||||
|
name: server
|
||||||
|
tasks_from: setup
|
||||||
|
- name: Servers - Setup cronjob mails
|
||||||
|
import_role:
|
||||||
|
name: server
|
||||||
|
tasks_from: cronmails
|
||||||
|
- name: Servers - Setup dyndns cronjob
|
||||||
|
import_role:
|
||||||
|
name: server
|
||||||
|
tasks_from: dyndns
|
||||||
|
- name: Servers - Setup monitoring
|
||||||
|
import_role:
|
||||||
|
name: server
|
||||||
|
tasks_from: telegraf
|
||||||
|
- name: Servers - Setup backups (if variables are set)
|
||||||
|
import_role:
|
||||||
|
name: server
|
||||||
|
tasks_from: borgbackup
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
- name: Servers - Install docker
|
||||||
|
import_role:
|
||||||
|
name: server
|
||||||
|
tasks_from: docker
|
||||||
|
- name: Servers - Add telegraf to docker group
|
||||||
|
become: yes
|
||||||
|
user:
|
||||||
|
name: telegraf
|
||||||
|
groups: docker
|
||||||
|
append: yes
|
||||||
|
|
||||||
|
# Caddy Webserver
|
||||||
|
- name: Servers - Install and setup caddy
|
||||||
|
import_role:
|
||||||
|
name: server
|
||||||
|
tasks_from: caddyserver
|
||||||
|
- name: Servers - Start caddy service
|
||||||
|
become: yes
|
||||||
|
service:
|
||||||
|
name: caddy
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
||||||
|
|
||||||
|
# UFW Firewall
|
||||||
|
- name: Servers - Install UFW
|
||||||
|
become: yes
|
||||||
|
apt:
|
||||||
|
name: ufw
|
||||||
|
state: latest
|
||||||
|
```
|
||||||
|
|
||||||
- hosts: servers
|
|
||||||
roles:
|
|
||||||
- { role: username.rolename, x: 42 }
|
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
GPLv3
|
GPLv3
|
||||||
|
|
||||||
Author Information
|
|
||||||
------------------
|
|
||||||
|
|
||||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
# defaults file for server
|
# defaults file for server
|
||||||
|
|
||||||
telegraf_docker_file: "telegraf-docker.conf"
|
telegraf_docker_file: "telegraf-docker.conf"
|
||||||
telegraf_snmp_file: "telegraf-SNMP.conf"
|
telegraf_snmp_fra80_file: "telegraf-SNMP_fra80.conf"
|
||||||
|
|
|
@ -1,2 +1,10 @@
|
||||||
---
|
---
|
||||||
# tasks file for server
|
# Common Server Setup Tasks
|
||||||
|
# This default task will leave out mosts of the availabe tasks intentionnally.
|
||||||
|
# Activate them on a case-by-case basis.
|
||||||
|
|
||||||
|
- name: Basic setup
|
||||||
|
import_tasks: setup.yml
|
||||||
|
|
||||||
|
- name: Setup cronjob mails
|
||||||
|
import_tasks: cronmails.yml
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
# Server/Telegraf: Install and Setup Telegraf Monitoring
|
# Server/Telegraf: Install and Setup Telegraf Monitoring
|
||||||
# Variables:
|
# Variables:
|
||||||
# - telegraf_snmp: boolean, enable SNMP monitoring
|
# - telegraf_snmp_fra80: boolean, enable SNMP monitoring for the fra80 network
|
||||||
# - telegraf_docker: boolean, enable docker monitoring
|
# - telegraf_docker: boolean, enable docker monitoring
|
||||||
|
|
||||||
- name: telegraf - Install apt-transport-https
|
- name: telegraf - Install apt-transport-https
|
||||||
|
|
|
@ -65,8 +65,8 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% if telegraf_snmp|default(false)|bool %}
|
{% if telegraf_snmp_fra80|default(false)|bool %}
|
||||||
{% include telegraf_snmp_file %}
|
{% include telegraf_snmp_fra80_file %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue