1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00

ansible: remove alertmanager and unifi, moved to NixOS

Signed-off-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
Matt Layher 2020-06-10 16:40:15 -04:00
parent 6af56202db
commit 72ea8d554b
No known key found for this signature in database
GPG key ID: 77BFE531397EDE94
10 changed files with 0 additions and 278 deletions

View file

@ -5,4 +5,3 @@
roles:
- sshkeys
- node_exporter
- alertmanager

View file

@ -18,10 +18,6 @@ monitor:
monitnerr-1:
host_bin_path: "/usr/local/bin"
host_golang_arch: "armv7"
alertmanager_sha256: "d0db8003279ca8cdb74150ebcf90dae6c9974bc5ac3aa7c220dcf5ea430636a2"
blackbox_exporter_sha256: "1aa3934b1bcd03ae5c206b4788dff3c931a0c8643459f276205e86ef0f056bfc"
node_exporter_sha256: "5de85067f44b42b22d62b2789cb1a379ff5559649b99795cd1ba0c144b512ad0"
node_exporter_use_textfile: false
unifi:
hosts:
unifi.servnerr.com:

View file

@ -1,145 +0,0 @@
---
- name: check if installing a different version of alertmanager
tags:
- alertmanager
shell: "cat {{ alertmanager_config }}/.sha256"
ignore_errors: true
register: checksum
- name: determine if alertmanager {{ alertmanager_version}} should be installed
tags:
- alertmanager
set_fact:
alertmanager_install: (checksum.stdout.find(alertmanager_sha256) == -1) or (alertmanager_force is defined)
- name: download and checksum alertmanager {{ alertmanager_version }} {{host_golang_arch }} tarball
tags:
- alertmanager
when: alertmanager_install
get_url:
url: "{{ alertmanager_url }}"
dest: "{{ alertmanager_tgz }}"
checksum: "sha256:{{ alertmanager_sha256 }}"
- name: unpack alertmanager tarball
tags:
- alertmanager
when: alertmanager_install
unarchive:
src: "{{ alertmanager_tgz }}"
dest: "/tmp/"
copy: false
- name: create alertmanager user
tags:
- alertmanager
when: alertmanager_install
user:
name: alertmanager
shell: "/bin/false"
comment: "alertmanager service user"
- name: check if alertmanager service exists
tags:
- alertmanager
stat:
path: "/etc/systemd/system/alertmanager.service"
register: svccheck
- name: stop alertmanager service if it exists
tags:
- alertmanager
when: svccheck.stat.exists
service:
name: alertmanager
state: stopped
- name: copy alertmanager binaries to {{ host_bin_path }}
tags:
- alertmanager
when: alertmanager_install
command: "cp {{ alertmanager_tmp }}/{{ item }} {{ host_bin_path }}/"
with_items:
- "alertmanager"
- "amtool"
- name: set permissions on alertmanager binaries
tags:
- alertmanager
when: alertmanager_install
file:
path: "{{ host_bin_path }}/{{ item }}"
owner: alertmanager
group: alertmanager
mode: 0755
with_items:
- "alertmanager"
- "amtool"
- name: create alertmanager config directory
tags:
- alertmanager
when: alertmanager_install
file:
path: "{{ alertmanager_config }}"
state: directory
owner: alertmanager
group: alertmanager
mode: 0755
- name: create alertmanager configuration
tags:
- alertmanager
template:
src: alertmanager.yml.j2
dest: "{{ alertmanager_config }}/alertmanager.yml"
- name: create alertmanager data directory
tags:
- alertmanager
when: alertmanager_install
file:
path: "{{ alertmanager_data }}"
state: directory
owner: alertmanager
group: alertmanager
mode: 0755
- name: create alertmanager systemd unit
tags:
- alertmanager
template:
src: alertmanager.service.j2
dest: "/etc/systemd/system/alertmanager.service"
- name: reload systemd configurations
tags:
- alertmanager
command: "systemctl daemon-reload"
- name: start alertmanager service
tags:
- alertmanager
service:
name: alertmanager
state: started
enabled: true
- name: remove temporary alertmanager files
tags:
- alertmanager
when: alertmanager_install
file:
path: "{{ item }}"
state: absent
with_items:
- "{{ alertmanager_tmp }}"
- "{{ alertmanager_tgz }}"
- name: create checksum file for alertmanager {{ alertmanager_version }}
tags:
- alertmanager
when: alertmanager_install
template:
src: sha256.j2
dest: "{{ alertmanager_config }}/.sha256"

View file

@ -1,18 +0,0 @@
# {{ ansible_managed }}
[Unit]
Description=Prometheus Alertmanager alerting system
Documentation=https://prometheus.io/docs/introduction/overview/
Wants=network-online.target
After=network-online.target
[Service]
User=alertmanager
Group=alertmanager
Type=simple
ExecStart={{ host_bin_path }}/alertmanager \
--config.file {{ alertmanager_config }}/alertmanager.yml \
--storage.path {{ alertmanager_data }} \
--web.external-url {{ alertmanager_external_url }}
[Install]
WantedBy=multi-user.target

View file

@ -1,23 +0,0 @@
---
# {{ ansible_managed }}
global:
resolve_timeout: 5m
route:
group_by: ['alertname']
group_wait: 10s
group_interval: 10s
repeat_interval: 1h
receiver: 'default'
receivers:
- name: 'default'
pushover_configs:
- user_key: "{{ alertmanager_pushover_user_key }}"
token: "{{ alertmanager_pushover_token }}"
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'dev', 'instance']

View file

@ -1,3 +0,0 @@
# {{ ansible_managed }}
# Remove this file to force ansible to reinstall alertmanager {{ alertmanager_version }}.
{{ alertmanager_sha256 }}

View file

@ -1,42 +0,0 @@
$ANSIBLE_VAULT;1.1;AES256
63336631383830636133343063306137313830643133646261373063356538626263326137626363
6565353662303432323363306136346666386563333833350a383534666430343833623530646561
35366533316465616461373336613133366636363730623135656233653630306437396432663761
3135646239373063300a376632336637653434376362626262396565303566633062333130336138
61386335323762306439396339313063326235333539326465303836363064303933393031313036
31356363383863303366313239376331316638333561616130363461336363316639613964316564
62626165626461356365353533363835383039643537663163333463666462666332326130343961
66353035643465653430336337336130306634636464636234623733393133353232323165363938
37336139343635333662363566356661646432303239636139643563383164313934663532373865
36336164323630306663343937663666663363303332663537653030313761636336393232666266
32303162303933353363613463333361633364313832386138643230636266633365636631663436
65366130633235623134343030373932663965356634366437386233353639643336373331346131
34656539313030636133316330653339636637643633373265383963666239306361623061363033
35353166353932633330313163383538313435343966616331346138663838323635613061353535
38383839633536643263393534393266383839376431633531623331346230636236626365633535
65346330613138623562653932326661616539356436343138633461663434393637613133303839
64363433313936336435373438313534396565383066396334343662633361653135613339366364
37613338373236663766623130383063366462626338656566393637323261313330343366643764
65383038616630343336623236643532333062373132623031346239613139656631313035343566
62363938326665336366393937393263353735626637663364656661643635393634303761656262
32353330303634666232336536386439623936613864346263306265306466326230373439386664
63323963366238643163396237353262353163316332323964323735623865656630336138373964
66633332653362663061663861633230653837373164303039373465353263333235386338313964
38343731633735396435336638396366613133316664613234663839363432303661666632393633
64383833666566643634636662363636623936646230636465623663383135383334323966313634
34393963376233383031386139653633393261343763376638346437313834343862666533386239
35346230653930666333363761383933656335636462313462646434623965333630646465336362
38353930363032313335393562393564303961346639356232336662356364366664343364643932
34353232663864646230663937343062313138373136626337666562313061326231363631343936
38323666383134316531306464343331383336303632313733366633393364393737306335333131
32616139636331313466633233643634613631666166633666613638666265333832653966373162
62343530366238396335636332356166613763306438336536316236356235346265636433386464
34336364666566326362656337356233333434656464613533396632626136343066313661636634
39323231623433353532323938653764313261616634313331326262393230333165346166623931
36656561366338356236343232363534633461366536613538643331333763373435376164626266
31623035343531376235393735353232633536333036613132393265343236616662636432633234
64366431353865643833323237386339333163653764366266373762643730383534646633343434
66623966386261356331636138303764333630636334333961376564633665633832636536626134
34643934386432333565316334613430356263646664303562336664333965666364316566343362
36323835316363623863323231333331343530363737333034613231626630383063643532346161
3861

View file

@ -1,32 +0,0 @@
---
- name: add unifi apt key
tags:
- unifi
apt_key:
keyserver: "keyserver.ubuntu.com"
id: C0A52C50
- name: add unifi apt repository
tags:
- unifi
apt_repository:
repo: "deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti"
state: present
- name: install haveged and unifi controller
tags:
- unifi
apt:
pkg:
- haveged
- unifi
state: present
update_cache: true
- name: start unifi service
tags:
- unifi
service:
name: unifi
state: started
enabled: true

View file

@ -1,8 +1,2 @@
[servnerr]
test-ansible
[workstation]
test-ansible
[unifi]
test-ansible

View file

@ -1,4 +0,0 @@
---
- hosts: unifi
roles:
- unifi