Compare commits

...

9 Commits

18 changed files with 1328 additions and 144 deletions

View File

@ -28,6 +28,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "s",
"gauge": {
"maxValue": 100,
@ -59,7 +65,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -158,6 +163,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "s",
"gauge": {
"maxValue": 100,
@ -189,7 +200,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -288,6 +298,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "bps",
"gauge": {
"maxValue": 100,
@ -319,7 +335,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -430,6 +445,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "bps",
"gauge": {
"maxValue": 100,
@ -461,7 +482,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -572,6 +592,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "celsius",
"gauge": {
"maxValue": 100,
@ -603,7 +629,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -696,6 +721,12 @@
],
"datasource": null,
"decimals": 1,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"format": "fahrenheit",
"gauge": {
"maxValue": 100,
@ -727,7 +758,6 @@
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"options": {},
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
@ -809,6 +839,335 @@
],
"valueName": "current"
},
{
"aliasColors": {},
"bars": false,
"cacheTimeout": null,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {},
"decimals": 1,
"mappings": [
{
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"nullValueMode": "connected",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "fahrenheit"
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 4
},
"hiddenSeries": false,
"id": 37,
"interval": null,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"maxDataPoints": 100,
"nullPointMode": "connected",
"options": {
"dataLinks": []
},
"percentage": false,
"pluginVersion": "7.0.0",
"pointradius": 2,
"points": true,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "snmp",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT mean(\"temperature\") * 9/5 + 32 FROM \"snmp\" WHERE (\"agent_host\" = '172.16.100.3') AND $timeFilter GROUP BY time($__interval) fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"temperature"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "agent_host",
"operator": "=",
"value": "172.16.100.3"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Switch Temperature (F)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:510",
"format": "fahrenheit",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:511",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"cacheTimeout": null,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {},
"decimals": 1,
"mappings": [
{
"id": 0,
"op": "=",
"text": "N/A",
"type": 1,
"value": "null"
}
],
"nullValueMode": "connected",
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "fahrenheit"
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 4
},
"hiddenSeries": false,
"id": 38,
"interval": null,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"maxDataPoints": 100,
"nullPointMode": "connected",
"options": {
"dataLinks": []
},
"percentage": false,
"pluginVersion": "7.0.0",
"pointradius": 2,
"points": true,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "snmp",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT max(\"temperature\") FROM \"snmp\" WHERE (\"agent_host\" = '172.16.100.3') AND $timeFilter GROUP BY time($__interval) fill(null)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"temperature"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"tags": [
{
"key": "agent_host",
"operator": "=",
"value": "172.16.100.3"
}
]
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Switch Temperature (C)",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"$$hashKey": "object:453",
"format": "celsius",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"$$hashKey": "object:454",
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"alert": {
"alertRuleTags": {},
@ -850,13 +1209,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 4
"y": 12
},
"hiddenSeries": false,
"id": 14,
@ -1150,13 +1515,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 4
"y": 12
},
"hiddenSeries": false,
"id": 29,
@ -1424,13 +1795,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 12
"y": 20
},
"hiddenSeries": false,
"id": 35,
@ -1681,13 +2058,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 12
"y": 20
},
"hiddenSeries": false,
"id": 36,
@ -1946,13 +2329,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 20
"y": 28
},
"hiddenSeries": false,
"id": 16,
@ -2191,13 +2580,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 20
"y": 28
},
"hiddenSeries": false,
"id": 30,
@ -2436,13 +2831,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 28
"y": 36
},
"hiddenSeries": false,
"id": 31,
@ -2681,13 +3082,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 28
"y": 36
},
"hiddenSeries": false,
"id": 32,
@ -2926,13 +3333,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 36
"y": 44
},
"hiddenSeries": false,
"id": 5,
@ -3115,13 +3528,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 36
"y": 44
},
"hiddenSeries": false,
"id": 10,
@ -3304,13 +3723,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 44
"y": 52
},
"hiddenSeries": false,
"id": 9,
@ -3493,13 +3918,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 44
"y": 52
},
"hiddenSeries": false,
"id": 11,
@ -3682,13 +4113,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 52
"y": 60
},
"hiddenSeries": false,
"id": 12,
@ -3871,13 +4308,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 52
"y": 60
},
"hiddenSeries": false,
"id": 33,
@ -4060,13 +4503,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 60
"y": 68
},
"hiddenSeries": false,
"id": 23,
@ -4243,13 +4692,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 60
"y": 68
},
"hiddenSeries": false,
"id": 18,
@ -4434,13 +4889,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 68
"y": 76
},
"hiddenSeries": false,
"id": 26,
@ -4617,13 +5078,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 68
"y": 76
},
"hiddenSeries": false,
"id": 24,
@ -4800,13 +5267,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 76
"y": 84
},
"hiddenSeries": false,
"id": 25,
@ -4983,13 +5456,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 76
"y": 84
},
"hiddenSeries": false,
"id": 27,
@ -5166,13 +5645,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 84
"y": 92
},
"hiddenSeries": false,
"id": 20,
@ -5349,13 +5834,19 @@
"dashLength": 10,
"dashes": false,
"datasource": null,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 84
"y": 92
},
"hiddenSeries": false,
"id": 21,
@ -5528,7 +6019,7 @@
}
],
"refresh": "5s",
"schemaVersion": 21,
"schemaVersion": 25,
"style": "dark",
"tags": [],
"templating": {
@ -5540,7 +6031,6 @@
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
@ -5555,5 +6045,5 @@
"timezone": "",
"title": "Home Networking",
"uid": "N0X50kOWk",
"version": 5
"version": 6
}

File diff suppressed because it is too large Load Diff

48
playbook.yaml Normal file
View File

@ -0,0 +1,48 @@
---
- hosts: all
roles:
- common
- util
- sudo
- hostsfile
- { role: vm_guest, when: "ansible_virtualization_type is defined" }
- grub
- certs
- rsyslog
- users
- network
- dns
- firewall
- openssh
- openvpn
- autossh
- spiped
- chrony
- unattended-upgrades
- postfix
- aide
- telegraf
- restic
- hosts: minecraft_servers
roles:
- minecraft
- craftbukkit
- hosts: jump_servers
roles:
- go
- hosts: git_servers
roles:
- nginx
- certbot
- gitea
- hosts: stats_servers
roles:
- nginx
- certbot
- influxdb
- grafana
- hosts: name_servers
roles:
- nsd
# vim:ft=yaml.ansible:

View File

@ -4,6 +4,7 @@ autossh_package_state: present
autossh_service_name: autossh@.service
autossh_systemd_unit_path: /etc/systemd/system/autossh@.service
autossh_systemd_unit_state: present
autossh_etc_path: /etc/autossh
autossh_run_path: /run/autossh

View File

@ -31,6 +31,7 @@
package:
name: "{{ autossh_package_name }}"
state: "{{ autossh_package_state }}"
- name: manage keys "{{ item }}"
include: keys.yaml
loop:
@ -70,8 +71,30 @@
notify: reload autossh instances
- name: manage services
service:
systemd:
name: "autossh@{{ item.name }}.service"
state: "{{ item.state | default('started') }}"
enabled: "{{ item.enabled | default(true) }}"
state: "{{ (item.state | default('present') == 'absent') | ternary('stopped', 'started') }}"
enabled: "{{ item.state | default('present') != 'absent' }}"
daemon_reload: true
loop: "{{ autossh_config | default([]) }}"
- name: remove systemd unit
file:
path: "{{ autossh_systemd_unit_path }}"
state: absent
notify:
- autossh daemon-reload
when:
- ansible_service_mgr == 'systemd'
- autossh_systemd_unit_state == "absent"
no_log: true
- name: configure autossh tunnels
file:
path: "{{ autossh_etc_path }}/{{ item.name }}"
state: absent
loop: "{{ autossh_config | default([]) }}"
when:
- ansible_service_mgr == 'systemd'
- item.state is defined
- item.state == "absent"

View File

@ -0,0 +1,2 @@
---
certs_trusted_ca: {}

View File

@ -0,0 +1,5 @@
---
- name: update-ca-certificates
command: update-ca-certificates
# vim:ft=yaml.ansible:

View File

@ -0,0 +1,10 @@
---
- name: add trusted ca certificates
copy:
dest: "{{ certs_trusted_ca_path }}/{{ item.key }}.crt"
content: "{{ item.value }}"
owner: root
group: root
mode: "0644"
loop: "{{ certs_trusted_ca | dict2items }}"
notify: update-ca-certificates

View File

@ -0,0 +1,24 @@
---
- name: gather os specific variables
include_vars: "{{ lookup('first_found', possible_files) }}"
vars:
possible_files:
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- vars
- name: include os specific tasks
include_tasks: "{{ lookup('first_found', possible_files) }}"
vars:
possible_files:
files:
- "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yaml"
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
paths:
- tasks

View File

@ -0,0 +1,2 @@
---
certs_trusted_ca_path: /usr/local/share/ca-certificates

View File

@ -16,7 +16,8 @@ PATTERNS = (
(re.compile(r"(\S+) (joined|left) the game"), "{0} {1} the game"),
(re.compile(r"\[(\S+): Gave (\d+) \[(.+)\] to (\S+)\]"), "{0} gave {1} \"{2}\" to {3}"),
(re.compile(r"(\S+) was (\S+) by (\S+)"), ":skull: {0} was {1} by {2}"),
(re.compile(r"(\S+) tried to swim in lava"), "{0} tried to swim in lava"),
(re.compile(r"(\S+) tried to swim in lava"), ":skull: {0} tried to swim in lava"),
(re.compile(r"(\S+) fell from a high place"), ":skull: {0} fell from a high place"),
)

View File

@ -49,6 +49,7 @@
owner: "{{ craftbukkit_user }}"
group: "{{ craftbukkit_group }}"
mode: "0644"
notify: restart craftbukkit
- name: agree to the eula
copy:

View File

@ -4,9 +4,9 @@ gitea_service_state: started
gitea_service_enabled: yes
gitea_arch: amd64
gitea_version: 1.11.4
gitea_version: 1.11.5
gitea_url: "https://dl.gitea.io/gitea/{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_arch }}"
gitea_checksum: sha256:4408c781069c36cbb1b5923ae924e67ceee661ba9c9bd6c73cd7408c9cd62af6
gitea_checksum: sha256:d8d43c13e71596c79b541e85e29defe065b4f70ac5155e6d0212bcfc669e1b9c
gitea_bin_path: /usr/local/bin
gitea_var_path: /var/lib/gitea
gitea_log_path: /var/log/gitea

View File

@ -9,6 +9,7 @@ grafana_service_enabled: yes
grafana_etc_path: /etc/grafana
grafana_config_path: "{{ grafana_etc_path }}/grafana.ini"
grafana_provisioning_path: /etc/grafana/provisioning
grafana_domain: "stats.{{ ansible_domain }}"
grafana_port: 3002
@ -21,3 +22,38 @@ grafana_config:
root_url: "https://{{ grafana_domain }}"
http_addr: localhost
http_port: "{{ grafana_port }}"
grafana_ssl_enabled: yes
grafana_ssl_certificate: "/etc/letsencrypt/live/{{ grafana_domain }}/fullchain.pem"
grafana_ssl_certificate_key: "/etc/letsencrypt/live/{{ grafana_domain }}/privkey.pem"
#grafana_ssl_dhparam: "/etc/letsencrypt/ssl-dhparams.pem"
grafana_datasources:
apiVersion: 1
datasources:
- name: influxdb
type: influxdb
access: proxy
url: http://localhost:8086
database: telegraf
isDefault: yes
version: 1
grafana_dashboards:
apiVersion: 1
providers:
- name: ansible
folder: Built-in
type: file
options:
path: /var/lib/grafana/dashboards
grafana_dashboard_files:
- connectivity.json
- home-networking.json
- iptables.json
- nginx.json
- processes.json
- switching.json
- system.json
- ups.json

View File

@ -44,6 +44,39 @@
mode: 0640
notify: restart grafana
- name: provision datasources
copy:
dest: "{{ grafana_provisioning_path }}/datasources/datasource.yaml"
content: "{{ grafana_datasources | to_nice_yaml }}"
owner: root
group: "{{ grafana_group }}"
mode: 0640
- name: create dashboard directory
file:
path: /var/lib/grafana/dashboards
state: directory
owner: "{{ grafana_user }}"
group: "{{ grafana_group }}"
mode: 0755
- name: provision dashboards
copy:
dest: "{{ grafana_provisioning_path }}/dashboards/dashboards.yaml"
content: "{{ grafana_dashboards | to_nice_yaml }}"
owner: root
group: "{{ grafana_group }}"
mode: 0640
- name: upload user dashboards
copy:
src: "files/grafana/dashboards/{{ item }}"
dest: "/var/lib/grafana/dashboards/{{ item | basename }}"
owner: "{{ grafana_user }}"
group: "{{ grafana_group }}"
mode: 0644
loop: "{{ grafana_dashboard_files | default([]) }}"
- name: manage service
service:
name: "{{ grafana_service_name }}"

View File

@ -12,9 +12,12 @@ from urlparse import urljoin
PATTERN = re.compile(r"(\S+) (joined|left) the game")
PATTERNS = (
(re.compile(r": (\S+)\[.+logged in"), "{0} joined the game"),
(re.compile(r"(\S+) (joined|left) the game"), "{0} {1} the game"),
(re.compile(r"\[(\S+): Gave (\d+) \[(.+)\] to (\S+)\]"), "{0} gave {1} \"{2}\" to {3}"),
(re.compile(r"(\S+) was (\S+) by (\S+)"), ":skull: {0} was {1} by {2}"),
(re.compile(r"(\S+) tried to swim in lava"), ":skull: {0} tried to swim in lava"),
(re.compile(r"(\S+) fell from a high place"), ":skull: {0} fell from a high place"),
)

View File

@ -8,3 +8,4 @@
name: "spiped-{{ item.name }}"
state: restarted
loop: "{{ spiped_tunnels | default([]) }}"
no_log: true

View File

@ -33,10 +33,12 @@
group: root
mode: 0644
loop: "{{ spiped_tunnels | default([]) }}"
when:
- ansible_service_mgr == 'systemd'
- item.state | default('present') == 'present'
notify:
- restart spiped tunnels
- spiped daemon-reload
when: ansible_service_mgr == 'systemd'
- restart spiped tunnels
no_log: true
- name: configure keys
@ -47,14 +49,41 @@
group: "{{ spiped_group }}"
mode: 0400
loop: "{{ spiped_tunnels | default([]) }}"
when:
- ansible_service_mgr == 'systemd'
- item.state | default('present') == 'present'
notify:
- restart spiped tunnels
no_log: true
- name: manage services
service:
systemd:
name: "spiped-{{ item.name }}.service"
state: "{{ item.state | default('started') }}"
enabled: "{{ item.enabled | default(true) }}"
state: "{{ (item.state | default('present') == 'absent') | ternary('stopped', 'started') }}"
enabled: "{{ item.state | default('present') != 'absent' }}"
daemon_reload: true
loop: "{{ spiped_tunnels | default([]) }}"
no_log: true
- name: remove keys
file:
path: "{{ spiped_etc_path }}/{{ item.name }}.key"
state: "absent"
loop: "{{ spiped_tunnels | default([]) }}"
when:
- item.state is defined
- item.state == "absent"
no_log: true
- name: remove systemd unit
file:
path: "/etc/systemd/system/spiped-{{ item.name }}.service"
state: "absent"
loop: "{{ spiped_tunnels | default([]) }}"
notify:
- spiped daemon-reload
when:
- ansible_service_mgr == 'systemd'
- item.state is defined
- item.state == "absent"
no_log: true