mirror of
https://github.com/mdlayher/homelab.git
synced 2024-12-14 11:47:32 +00:00
ansible: remove
Signed-off-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
parent
c9719e0735
commit
89b214c831
24 changed files with 0 additions and 827 deletions
|
@ -1,9 +0,0 @@
|
||||||
[defaults]
|
|
||||||
inventory = production.yml
|
|
||||||
vault_password_file = ~/.ansible/secrets/vault.txt
|
|
||||||
|
|
||||||
[privilege_escalation]
|
|
||||||
become = True
|
|
||||||
become_ask_pass = True
|
|
||||||
become_method = sudo
|
|
||||||
become_user = root
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
- hosts: all
|
|
||||||
roles:
|
|
||||||
- base
|
|
||||||
- node_exporter
|
|
|
@ -1,7 +0,0 @@
|
||||||
---
|
|
||||||
- hosts: monitor
|
|
||||||
become: true
|
|
||||||
become_user: root
|
|
||||||
roles:
|
|
||||||
- sshkeys
|
|
||||||
- node_exporter
|
|
|
@ -1,23 +0,0 @@
|
||||||
---
|
|
||||||
amd64:
|
|
||||||
hosts:
|
|
||||||
nerr-3:
|
|
||||||
vars:
|
|
||||||
host_bin_path: "/usr/local/bin"
|
|
||||||
host_golang_arch: "amd64"
|
|
||||||
host_xdg: "/run/user/1000"
|
|
||||||
node_exporter_sha256: "b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424"
|
|
||||||
node_exporter_use_textfile: true
|
|
||||||
promtail_sha256: "0354e2298b154c81286075c44dfbceda801c362de98e03a2c94e9edf22fd86ae"
|
|
||||||
workstation:
|
|
||||||
hosts:
|
|
||||||
nerr-3:
|
|
||||||
apcupsd_battery_date: "11/29/2016"
|
|
||||||
monitor:
|
|
||||||
hosts:
|
|
||||||
monitnerr-1:
|
|
||||||
host_bin_path: "/usr/local/bin"
|
|
||||||
host_golang_arch: "armv7"
|
|
||||||
blackbox_exporter_sha256: "1aa3934b1bcd03ae5c206b4788dff3c931a0c8643459f276205e86ef0f056bfc"
|
|
||||||
node_exporter_sha256: "5de85067f44b42b22d62b2789cb1a379ff5559649b99795cd1ba0c144b512ad0"
|
|
||||||
node_exporter_use_textfile: false
|
|
|
@ -1,28 +0,0 @@
|
||||||
---
|
|
||||||
- name: install apcupsd
|
|
||||||
tags:
|
|
||||||
- apcupsd
|
|
||||||
apt:
|
|
||||||
pkg: apcupsd
|
|
||||||
state: installed
|
|
||||||
|
|
||||||
- name: create apcupsd configuration
|
|
||||||
tags:
|
|
||||||
- apcupsd
|
|
||||||
template:
|
|
||||||
src: apcupsd.conf.j2
|
|
||||||
dest: "/etc/apcupsd/apcupsd.conf"
|
|
||||||
|
|
||||||
- name: set apcupsd as configured
|
|
||||||
tags:
|
|
||||||
- apcupsd
|
|
||||||
template:
|
|
||||||
src: apcupsd.j2
|
|
||||||
dest: "/etc/default/apcupsd"
|
|
||||||
|
|
||||||
- name: restart apcupsd
|
|
||||||
tags:
|
|
||||||
- apcupsd
|
|
||||||
service:
|
|
||||||
name: apcupsd
|
|
||||||
state: restarted
|
|
|
@ -1,181 +0,0 @@
|
||||||
## apcupsd.conf v1.1 ##
|
|
||||||
# {{ ansible_managed }}
|
|
||||||
|
|
||||||
# USB UPS configuration only.
|
|
||||||
UPSCABLE usb
|
|
||||||
UPSTYPE usb
|
|
||||||
|
|
||||||
# POLLTIME <int>
|
|
||||||
# Interval (in seconds) at which apcupsd polls the UPS for status. This
|
|
||||||
# setting applies both to directly-attached UPSes (UPSTYPE apcsmart, usb,
|
|
||||||
# dumb) and networked UPSes (UPSTYPE net, snmp). Lowering this setting
|
|
||||||
# will improve apcupsd's responsiveness to certain events at the cost of
|
|
||||||
# higher CPU utilization. The default of 60 is appropriate for most
|
|
||||||
# situations.
|
|
||||||
POLLTIME 20
|
|
||||||
|
|
||||||
# LOCKFILE <path to lockfile>
|
|
||||||
# Path for device lock file. Not used on Win32.
|
|
||||||
LOCKFILE /var/lock
|
|
||||||
|
|
||||||
# SCRIPTDIR <path to script directory>
|
|
||||||
# Directory in which apccontrol and event scripts are located.
|
|
||||||
SCRIPTDIR /etc/apcupsd
|
|
||||||
|
|
||||||
# PWRFAILDIR <path to powerfail directory>
|
|
||||||
# Directory in which to write the powerfail flag file. This file
|
|
||||||
# is created when apcupsd initiates a system shutdown and is
|
|
||||||
# checked in the OS halt scripts to determine if a killpower
|
|
||||||
# (turning off UPS output power) is required.
|
|
||||||
PWRFAILDIR /etc/apcupsd
|
|
||||||
|
|
||||||
# NOLOGINDIR <path to nologin directory>
|
|
||||||
# Directory in which to write the nologin file. The existence
|
|
||||||
# of this flag file tells the OS to disallow new logins.
|
|
||||||
NOLOGINDIR /etc
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# ======== Configuration parameters used during power failures ==========
|
|
||||||
#
|
|
||||||
|
|
||||||
# The ONBATTERYDELAY is the time in seconds from when a power failure
|
|
||||||
# is detected until we react to it with an onbattery event.
|
|
||||||
#
|
|
||||||
# This means that, apccontrol will be called with the powerout argument
|
|
||||||
# immediately when a power failure is detected. However, the
|
|
||||||
# onbattery argument is passed to apccontrol only after the
|
|
||||||
# ONBATTERYDELAY time. If you don't want to be annoyed by short
|
|
||||||
# powerfailures, make sure that apccontrol powerout does nothing
|
|
||||||
# i.e. comment out the wall.
|
|
||||||
ONBATTERYDELAY 6
|
|
||||||
|
|
||||||
#
|
|
||||||
# Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so
|
|
||||||
# the first that occurs will cause the initation of a shutdown.
|
|
||||||
#
|
|
||||||
|
|
||||||
# If during a power failure, the remaining battery percentage
|
|
||||||
# (as reported by the UPS) is below or equal to BATTERYLEVEL,
|
|
||||||
# apcupsd will initiate a system shutdown.
|
|
||||||
BATTERYLEVEL 5
|
|
||||||
|
|
||||||
# If during a power failure, the remaining runtime in minutes
|
|
||||||
# (as calculated internally by the UPS) is below or equal to MINUTES,
|
|
||||||
# apcupsd, will initiate a system shutdown.
|
|
||||||
MINUTES 3
|
|
||||||
|
|
||||||
# If during a power failure, the UPS has run on batteries for TIMEOUT
|
|
||||||
# many seconds or longer, apcupsd will initiate a system shutdown.
|
|
||||||
# A value of 0 disables this timer.
|
|
||||||
#
|
|
||||||
# Note, if you have a Smart UPS, you will most likely want to disable
|
|
||||||
# this timer by setting it to zero. That way, you UPS will continue
|
|
||||||
# on batteries until either the % charge remaing drops to or below BATTERYLEVEL,
|
|
||||||
# or the remaining battery runtime drops to or below MINUTES. Of course,
|
|
||||||
# if you are testing, setting this to 60 causes a quick system shutdown
|
|
||||||
# if you pull the power plug.
|
|
||||||
# If you have an older dumb UPS, you will want to set this to less than
|
|
||||||
# the time you know you can run on batteries.
|
|
||||||
TIMEOUT 0
|
|
||||||
|
|
||||||
# Time in seconds between annoying users to signoff prior to
|
|
||||||
# system shutdown. 0 disables.
|
|
||||||
ANNOY 300
|
|
||||||
|
|
||||||
# Initial delay after power failure before warning users to get
|
|
||||||
# off the system.
|
|
||||||
ANNOYDELAY 60
|
|
||||||
|
|
||||||
# The condition which determines when users are prevented from
|
|
||||||
# logging in during a power failure.
|
|
||||||
# NOLOGON <string> [ disable | timeout | percent | minutes | always ]
|
|
||||||
NOLOGON disable
|
|
||||||
|
|
||||||
# If KILLDELAY is non-zero, apcupsd will continue running after a
|
|
||||||
# shutdown has been requested, and after the specified time in
|
|
||||||
# seconds attempt to kill the power. This is for use on systems
|
|
||||||
# where apcupsd cannot regain control after a shutdown.
|
|
||||||
# KILLDELAY <seconds> 0 disables
|
|
||||||
KILLDELAY 0
|
|
||||||
|
|
||||||
#
|
|
||||||
# ==== Configuration statements for Network Information Server ====
|
|
||||||
#
|
|
||||||
|
|
||||||
# NETSERVER [ on | off ] on enables, off disables the network
|
|
||||||
# information server. If netstatus is on, a network information
|
|
||||||
# server process will be started for serving the STATUS and
|
|
||||||
# EVENT data over the network (used by CGI programs).
|
|
||||||
NETSERVER on
|
|
||||||
|
|
||||||
# NISIP <dotted notation ip address>
|
|
||||||
# IP address on which NIS server will listen for incoming connections.
|
|
||||||
# This is useful if your server is multi-homed (has more than one
|
|
||||||
# network interface and IP address). Default value is 0.0.0.0 which
|
|
||||||
# means any incoming request will be serviced. Alternatively, you can
|
|
||||||
# configure this setting to any specific IP address of your server and
|
|
||||||
# NIS will listen for connections only on that interface. Use the
|
|
||||||
# loopback address (127.0.0.1) to accept connections only from the
|
|
||||||
# local machine.
|
|
||||||
NISIP 127.0.0.1
|
|
||||||
|
|
||||||
# NISPORT <port> default is 3551 as registered with the IANA
|
|
||||||
# port to use for sending STATUS and EVENTS data over the network.
|
|
||||||
# It is not used unless NETSERVER is on. If you change this port,
|
|
||||||
# you will need to change the corresponding value in the cgi directory
|
|
||||||
# and rebuild the cgi programs.
|
|
||||||
NISPORT 3551
|
|
||||||
|
|
||||||
# If you want the last few EVENTS to be available over the network
|
|
||||||
# by the network information server, you must define an EVENTSFILE.
|
|
||||||
EVENTSFILE /var/log/apcupsd/apcupsd.events
|
|
||||||
|
|
||||||
# EVENTSFILEMAX <kilobytes>
|
|
||||||
# By default, the size of the EVENTSFILE will be not be allowed to exceed
|
|
||||||
# 10 kilobytes. When the file grows beyond this limit, older EVENTS will
|
|
||||||
# be removed from the beginning of the file (first in first out). The
|
|
||||||
# parameter EVENTSFILEMAX can be set to a different kilobyte value, or set
|
|
||||||
# to zero to allow the EVENTSFILE to grow without limit.
|
|
||||||
EVENTSFILEMAX 10
|
|
||||||
|
|
||||||
#
|
|
||||||
# ========== Configuration statements used if sharing =============
|
|
||||||
# a UPS with more than one machine
|
|
||||||
|
|
||||||
#
|
|
||||||
# Remaining items are for ShareUPS (APC expansion card) ONLY
|
|
||||||
#
|
|
||||||
|
|
||||||
# UPSCLASS [ standalone | shareslave | sharemaster ]
|
|
||||||
# Normally standalone unless you share an UPS using an APC ShareUPS
|
|
||||||
# card.
|
|
||||||
UPSCLASS standalone
|
|
||||||
|
|
||||||
# UPSMODE [ disable | share ]
|
|
||||||
# Normally disable unless you share an UPS using an APC ShareUPS card.
|
|
||||||
UPSMODE disable
|
|
||||||
|
|
||||||
#
|
|
||||||
# ===== Configuration statements to control apcupsd system logging ========
|
|
||||||
#
|
|
||||||
|
|
||||||
# Time interval in seconds between writing the STATUS file; 0 disables
|
|
||||||
STATTIME 0
|
|
||||||
|
|
||||||
# Location of STATUS file (written to only if STATTIME is non-zero)
|
|
||||||
STATFILE /var/log/apcupsd.status
|
|
||||||
|
|
||||||
# LOGSTATS [ on | off ] on enables, off disables
|
|
||||||
# Note! This generates a lot of output, so if
|
|
||||||
# you turn this on, be sure that the
|
|
||||||
# file defined in syslog.conf for LOG_NOTICE is a named pipe.
|
|
||||||
# You probably do not want this on.
|
|
||||||
LOGSTATS off
|
|
||||||
|
|
||||||
# Time interval in seconds between writing the DATA records to
|
|
||||||
# the log file. 0 disables.
|
|
||||||
DATATIME 0
|
|
||||||
|
|
||||||
# Battery date - 8 characters
|
|
||||||
BATTDATE {{ apcupsd_battery_date }}
|
|
|
@ -1,6 +0,0 @@
|
||||||
# {{ ansible_managed }}
|
|
||||||
# Defaults for apcupsd initscript
|
|
||||||
|
|
||||||
# Apcupsd-devel internal configuration
|
|
||||||
APCACCESS=/sbin/apcaccess
|
|
||||||
ISCONFIGURED=yes
|
|
|
@ -1,72 +0,0 @@
|
||||||
---
|
|
||||||
- name: download and checksum apcupsd_exporter binary
|
|
||||||
tags:
|
|
||||||
- apcupsd_exporter
|
|
||||||
get_url:
|
|
||||||
url: "{{ apcupsd_exporter_url }}"
|
|
||||||
dest: "/tmp/apcupsd_exporter"
|
|
||||||
checksum: "sha256:{{ apcupsd_exporter_sha256 }}"
|
|
||||||
|
|
||||||
- name: create apcupsd_exporter user
|
|
||||||
tags:
|
|
||||||
- apcupsd_exporter
|
|
||||||
user:
|
|
||||||
name: apcupsd_exporter
|
|
||||||
shell: "/bin/false"
|
|
||||||
comment: "apcupsd_exporter service user"
|
|
||||||
|
|
||||||
- name: check if apcupsd_exporter service exists
|
|
||||||
tags:
|
|
||||||
- apcupsd_exporter
|
|
||||||
stat:
|
|
||||||
path: "/etc/systemd/system/apcupsd_exporter.service"
|
|
||||||
register: checked
|
|
||||||
|
|
||||||
- name: stop apcupsd_exporter service if it exists
|
|
||||||
tags:
|
|
||||||
- apcupsd_exporter
|
|
||||||
when: checked.stat.exists
|
|
||||||
service:
|
|
||||||
name: apcupsd_exporter
|
|
||||||
state: stopped
|
|
||||||
|
|
||||||
- name: copy apcupsd_exporter binary to {{ host_bin_path }}
|
|
||||||
tags:
|
|
||||||
- apcupsd_exporter
|
|
||||||
command: "cp /tmp/apcupsd_exporter {{ host_bin_path }}/"
|
|
||||||
|
|
||||||
- name: set permissions on apcupsd_exporter binary
|
|
||||||
tags:
|
|
||||||
- apcupsd_exporter
|
|
||||||
file:
|
|
||||||
path: "{{ host_bin_path }}/apcupsd_exporter"
|
|
||||||
owner: apcupsd_exporter
|
|
||||||
group: apcupsd_exporter
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: create apcupsd_exporter systemd unit
|
|
||||||
tags:
|
|
||||||
- apcupsd_exporter
|
|
||||||
template:
|
|
||||||
src: apcupsd_exporter.service.j2
|
|
||||||
dest: "/etc/systemd/system/apcupsd_exporter.service"
|
|
||||||
|
|
||||||
- name: reload systemd configurations
|
|
||||||
tags:
|
|
||||||
- apcupsd_exporter
|
|
||||||
command: "systemctl daemon-reload"
|
|
||||||
|
|
||||||
- name: start apcupsd_exporter service
|
|
||||||
tags:
|
|
||||||
- apcupsd_exporter
|
|
||||||
service:
|
|
||||||
name: apcupsd_exporter
|
|
||||||
state: started
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- name: remove temporary files
|
|
||||||
tags:
|
|
||||||
- apcupsd_exporter
|
|
||||||
file:
|
|
||||||
path: "/tmp/apcupsd_exporter"
|
|
||||||
state: absent
|
|
|
@ -1,16 +0,0 @@
|
||||||
# {{ ansible_managed }}
|
|
||||||
[Unit]
|
|
||||||
Description=Prometheus apcupsd exporter
|
|
||||||
Documentation=https://github.com/mdlayher/apcupsd_exporter
|
|
||||||
Requires=apcupsd.service
|
|
||||||
Wants=network-online.target
|
|
||||||
After=network-online.target apcupsd.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
User=apcupsd_exporter
|
|
||||||
Group=apcupsd_exporter
|
|
||||||
Type=simple
|
|
||||||
ExecStart={{ host_bin_path }}/apcupsd_exporter
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,3 +0,0 @@
|
||||||
---
|
|
||||||
apcupsd_exporter_url: "https://mdlayher.nyc3.digitaloceanspaces.com/bin/apcupsd_exporter"
|
|
||||||
apcupsd_exporter_sha256: "e15b9f664f7b2b201d758392a85bff26cf77e4ed79faf25b64fc79b9d3867518"
|
|
|
@ -1,90 +0,0 @@
|
||||||
---
|
|
||||||
- name: check for existing go installation
|
|
||||||
tags:
|
|
||||||
- golang
|
|
||||||
stat:
|
|
||||||
path: "{{ golang_root }}/bin/go"
|
|
||||||
register: checked
|
|
||||||
|
|
||||||
- name: determine version of existing go installation
|
|
||||||
tags:
|
|
||||||
- golang
|
|
||||||
# Do not report changes from running shell command to check version
|
|
||||||
changed_when: false
|
|
||||||
when: checked.stat.exists
|
|
||||||
command: "{{ golang_root }}/bin/go version"
|
|
||||||
register: version
|
|
||||||
|
|
||||||
- name: check if go version matches {{ golang_version }}
|
|
||||||
tags:
|
|
||||||
- golang
|
|
||||||
when: checked.stat.exists and version is success
|
|
||||||
set_fact:
|
|
||||||
# Install when reported version does not match specified version
|
|
||||||
install: "{{ version.stdout.find(golang_version) == -1 }}"
|
|
||||||
|
|
||||||
- name: cleanup existing go installation
|
|
||||||
tags:
|
|
||||||
- golang
|
|
||||||
when: checked.stat.exists and version is success and install
|
|
||||||
file:
|
|
||||||
path: "{{ golang_root }}"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: install go because no installation present
|
|
||||||
tags:
|
|
||||||
- golang
|
|
||||||
when: checked.stat.exists == false
|
|
||||||
set_fact:
|
|
||||||
install: true
|
|
||||||
|
|
||||||
- name: install version control clients used by go
|
|
||||||
tags:
|
|
||||||
- golang
|
|
||||||
when: install
|
|
||||||
apt:
|
|
||||||
pkg: "{{ item }}"
|
|
||||||
state: present
|
|
||||||
with_items:
|
|
||||||
- git
|
|
||||||
- mercurial
|
|
||||||
|
|
||||||
- name: download and checksum {{ golang_version }} tarball
|
|
||||||
tags:
|
|
||||||
- golang
|
|
||||||
when: install
|
|
||||||
get_url:
|
|
||||||
url: "{{ golang_url }}"
|
|
||||||
dest: "{{ golang_tgz }}"
|
|
||||||
checksum: "sha256:{{ golang_sha256 }}"
|
|
||||||
|
|
||||||
- name: unpack tarball
|
|
||||||
tags:
|
|
||||||
- golang
|
|
||||||
when: install
|
|
||||||
unarchive:
|
|
||||||
src: "{{ golang_tgz }}"
|
|
||||||
dest: "/usr/local/"
|
|
||||||
copy: false
|
|
||||||
|
|
||||||
- name: insert go configuration into shell profile
|
|
||||||
tags:
|
|
||||||
- golang
|
|
||||||
when: install
|
|
||||||
blockinfile:
|
|
||||||
dest: "{{ golang_user_home }}/.profile"
|
|
||||||
marker: "# {mark} ansible-managed Go configuration"
|
|
||||||
block: |
|
|
||||||
export GOROOT={{ golang_root }}
|
|
||||||
export GOROOT_BOOTSTRAP=$GOROOT
|
|
||||||
export GOPATH=$HOME
|
|
||||||
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
|
|
||||||
export CDPATH=$CDPATH:{{ golang_user_home }}/src/{{ golang_personal_gopath }}
|
|
||||||
|
|
||||||
- name: remove temporary go tarball
|
|
||||||
tags:
|
|
||||||
- golang
|
|
||||||
when: install
|
|
||||||
file:
|
|
||||||
path: "{{ golang_tgz }}"
|
|
||||||
state: absent
|
|
|
@ -1,12 +0,0 @@
|
||||||
---
|
|
||||||
# Go version to install and its tarball checksum.
|
|
||||||
golang_version: "go1.14.2"
|
|
||||||
golang_sha256: "6272d6e940ecb71ea5636ddb5fab3933e087c1356173c61f4a803895e947ebb3"
|
|
||||||
# Personal Go configuration.
|
|
||||||
golang_user: "matt"
|
|
||||||
golang_user_home: "/home/{{ golang_user }}"
|
|
||||||
golang_personal_gopath: "github.com/mdlayher"
|
|
||||||
# Static configuration.
|
|
||||||
golang_url: "https://storage.googleapis.com/golang/{{ golang_version }}.linux-amd64.tar.gz"
|
|
||||||
golang_tgz: "/tmp/golang.tar.gz"
|
|
||||||
golang_root: "/usr/local/go"
|
|
|
@ -1,128 +0,0 @@
|
||||||
---
|
|
||||||
- name: download and checksum node_exporter {{ host_golang_arch }} binary
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
get_url:
|
|
||||||
url: "{{ node_exporter_url }}"
|
|
||||||
dest: "{{ node_exporter_tgz }}"
|
|
||||||
checksum: "sha256:{{ node_exporter_sha256 }}"
|
|
||||||
|
|
||||||
- name: unpack node_exporter tarball
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
unarchive:
|
|
||||||
src: "{{ node_exporter_tgz }}"
|
|
||||||
dest: "/tmp/"
|
|
||||||
copy: false
|
|
||||||
|
|
||||||
- name: create node_exporter user
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
user:
|
|
||||||
name: node_exporter
|
|
||||||
shell: "/bin/false"
|
|
||||||
comment: "node_exporter service user"
|
|
||||||
|
|
||||||
- name: check if node_exporter service exists
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
stat:
|
|
||||||
path: "/etc/systemd/system/node_exporter.service"
|
|
||||||
register: checked
|
|
||||||
|
|
||||||
- name: stop node_exporter service if it exists
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
when: checked.stat.exists
|
|
||||||
service:
|
|
||||||
name: node_exporter
|
|
||||||
state: stopped
|
|
||||||
|
|
||||||
- name: copy node_exporter binary to {{ host_bin_path }}
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
command: "cp /tmp/{{ node_exporter_dir }}/node_exporter {{ host_bin_path }}/"
|
|
||||||
|
|
||||||
- name: set permissions on node_exporter binary
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
file:
|
|
||||||
path: "{{ host_bin_path }}/node_exporter"
|
|
||||||
owner: node_exporter
|
|
||||||
group: node_exporter
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: create node_exporter systemd unit
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
template:
|
|
||||||
src: node_exporter.service.j2
|
|
||||||
dest: "/etc/systemd/system/node_exporter.service"
|
|
||||||
|
|
||||||
- name: reload systemd configurations
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
command: "systemctl daemon-reload"
|
|
||||||
|
|
||||||
- name: create node_exporter textfile collector directory
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
when: node_exporter_use_textfile
|
|
||||||
file:
|
|
||||||
path: "{{ node_exporter_textfile_dir }}"
|
|
||||||
state: directory
|
|
||||||
owner: node_exporter
|
|
||||||
group: node_exporter
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: download textfile collector scripts
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
when: node_exporter_use_textfile
|
|
||||||
get_url:
|
|
||||||
url: "{{ item }}"
|
|
||||||
dest: "{{ node_exporter_textfile_dir }}/"
|
|
||||||
mode: 0744
|
|
||||||
with_items:
|
|
||||||
- "https://raw.githubusercontent.com/prometheus-community/node-exporter-textfile-collector-scripts/master/smartmon.sh"
|
|
||||||
- "https://raw.githubusercontent.com/prometheus-community/node-exporter-textfile-collector-scripts/master/nvme_metrics.sh"
|
|
||||||
|
|
||||||
- name: set cron PATH entries for scripts
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
when: node_exporter_use_textfile
|
|
||||||
cron:
|
|
||||||
name: PATH
|
|
||||||
env: true
|
|
||||||
job: "/usr/local/sbin:{{ host_bin_path }}:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
||||||
|
|
||||||
- name: enable textfile collector cronjobs
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
when: node_exporter_use_textfile
|
|
||||||
cron:
|
|
||||||
name: "{{ item }}"
|
|
||||||
minute: "*"
|
|
||||||
user: root
|
|
||||||
job: "{{ node_exporter_textfile_dir }}/{{ item }} > {{ node_exporter_textfile_dir }}/{{ item }}.prom"
|
|
||||||
with_items:
|
|
||||||
- "smartmon.sh"
|
|
||||||
- "nvme_metrics.sh"
|
|
||||||
|
|
||||||
- name: start node_exporter service
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
service:
|
|
||||||
name: node_exporter
|
|
||||||
state: started
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- name: remove temporary node_exporter files
|
|
||||||
tags:
|
|
||||||
- node_exporter
|
|
||||||
file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
state: absent
|
|
||||||
with_items:
|
|
||||||
- "/tmp/{{ node_exporter_dir }}"
|
|
||||||
- "{{ node_exporter_tgz }}"
|
|
|
@ -1,15 +0,0 @@
|
||||||
# {{ ansible_managed }}
|
|
||||||
[Unit]
|
|
||||||
Description=Prometheus node exporter
|
|
||||||
Documentation=https://github.com/prometheus/node_exporter
|
|
||||||
Wants=network-online.target
|
|
||||||
After=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
User=node_exporter
|
|
||||||
Group=node_exporter
|
|
||||||
Type=simple
|
|
||||||
ExecStart={{ host_bin_path }}/node_exporter {% if node_exporter_use_textfile is sameas true %}--collector.textfile.directory {{ node_exporter_textfile_dir }}{% endif %}
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,8 +0,0 @@
|
||||||
---
|
|
||||||
node_exporter_textfile_dir: "/var/lib/node_exporter"
|
|
||||||
# Version configuration.
|
|
||||||
node_exporter_version: "0.18.1"
|
|
||||||
# Static configuration.
|
|
||||||
node_exporter_dir: "node_exporter-{{ node_exporter_version }}.linux-{{ host_golang_arch }}"
|
|
||||||
node_exporter_url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/{{ node_exporter_dir }}.tar.gz"
|
|
||||||
node_exporter_tgz: "/tmp/node_exporter.tgz"
|
|
|
@ -1,136 +0,0 @@
|
||||||
---
|
|
||||||
- name: check if installing a different version of spotifyd
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
shell: "cat {{ spotifyd_config }}/.sha256"
|
|
||||||
ignore_errors: true
|
|
||||||
register: checksum
|
|
||||||
|
|
||||||
- name: determine if spotifyd {{ spotifyd_version}} should be installed
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
set_fact:
|
|
||||||
spotifyd_install: (checksum.stdout.find(spotifyd_sha256) == -1) or (spotifyd_force is defined)
|
|
||||||
|
|
||||||
- name: download and checksum spotifyd {{ spotifyd_version }} tarball
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
when: spotifyd_install
|
|
||||||
get_url:
|
|
||||||
url: "{{ spotifyd_url }}"
|
|
||||||
dest: "{{ spotifyd_tgz }}"
|
|
||||||
checksum: "sha256:{{ spotifyd_sha256 }}"
|
|
||||||
|
|
||||||
- name: unpack spotifyd tarball
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
when: spotifyd_install
|
|
||||||
unarchive:
|
|
||||||
src: "{{ spotifyd_tgz }}"
|
|
||||||
dest: "/tmp/"
|
|
||||||
copy: false
|
|
||||||
|
|
||||||
- name: check if spotifyd service exists
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
stat:
|
|
||||||
path: "/etc/systemd/user/spotifyd.service"
|
|
||||||
register: checked
|
|
||||||
|
|
||||||
- name: stop spotifyd service if it exists
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
when: checked.stat.exists
|
|
||||||
become: true
|
|
||||||
become_user: matt
|
|
||||||
environment:
|
|
||||||
XDG_RUNTIME_DIR: "{{ host_xdg }}"
|
|
||||||
systemd:
|
|
||||||
name: spotifyd
|
|
||||||
state: stopped
|
|
||||||
user: true
|
|
||||||
|
|
||||||
- name: copy spotifyd binary to {{ host_bin_path }}
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
when: spotifyd_install
|
|
||||||
command: "cp /tmp/spotifyd {{ host_bin_path }}/"
|
|
||||||
|
|
||||||
- name: set permissions on spotifyd binary
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
when: spotifyd_install
|
|
||||||
file:
|
|
||||||
path: "{{ host_bin_path }}/spotifyd"
|
|
||||||
owner: matt
|
|
||||||
group: matt
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: create spotifyd config directory
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
when: spotifyd_install
|
|
||||||
file:
|
|
||||||
path: "{{ spotifyd_config }}"
|
|
||||||
state: directory
|
|
||||||
owner: matt
|
|
||||||
group: matt
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: create spotifyd configuration
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
template:
|
|
||||||
src: spotifyd.conf.j2
|
|
||||||
dest: "{{ spotifyd_config }}/spotifyd.conf"
|
|
||||||
owner: matt
|
|
||||||
group: matt
|
|
||||||
mode: 0600
|
|
||||||
|
|
||||||
- name: create spotifyd data directory
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
when: spotifyd_install
|
|
||||||
file:
|
|
||||||
path: "{{ spotifyd_data }}"
|
|
||||||
state: directory
|
|
||||||
owner: matt
|
|
||||||
group: matt
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: create spotifyd systemd unit
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
template:
|
|
||||||
src: spotifyd.service.j2
|
|
||||||
dest: "/etc/systemd/user/spotifyd.service"
|
|
||||||
|
|
||||||
- name: start spotifyd service
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
become: true
|
|
||||||
become_user: matt
|
|
||||||
environment:
|
|
||||||
XDG_RUNTIME_DIR: "{{ host_xdg }}"
|
|
||||||
systemd:
|
|
||||||
name: spotifyd
|
|
||||||
daemon_reload: true
|
|
||||||
state: started
|
|
||||||
enabled: true
|
|
||||||
user: true
|
|
||||||
|
|
||||||
- name: remove temporary files
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
when: spotifyd_install
|
|
||||||
file:
|
|
||||||
path: "/tmp/spotifyd"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: create checksum file for spotifyd {{ spotifyd_version }}
|
|
||||||
tags:
|
|
||||||
- spotifyd
|
|
||||||
when: spotifyd_install
|
|
||||||
template:
|
|
||||||
src: sha256.j2
|
|
||||||
dest: "{{ spotifyd_config }}/.sha256"
|
|
|
@ -1,3 +0,0 @@
|
||||||
# {{ ansible_managed }}
|
|
||||||
# Remove this file to force ansible to reinstall spotifyd {{ spotifyd_version }}.
|
|
||||||
{{ spotifyd_sha256 }}
|
|
|
@ -1,14 +0,0 @@
|
||||||
# {{ ansible_managed }}
|
|
||||||
[global]
|
|
||||||
username = {{ spotifyd_username }}
|
|
||||||
password = {{ spotifyd_password }}
|
|
||||||
backend = alsa
|
|
||||||
device = pulse
|
|
||||||
mixer = PCM
|
|
||||||
volume_controller = alsa
|
|
||||||
device_name = {{ inventory_hostname }}
|
|
||||||
bitrate = 320
|
|
||||||
cache_path = {{ spotifyd_data }}
|
|
||||||
no_audio_cache = false
|
|
||||||
volume_normalisation = true
|
|
||||||
normalisation_pregain = -10
|
|
|
@ -1,16 +0,0 @@
|
||||||
# {{ ansible_managed }}
|
|
||||||
[Unit]
|
|
||||||
Description=A spotify playing daemon
|
|
||||||
Documentation=https://github.com/Spotifyd/spotifyd
|
|
||||||
Wants=sound.target
|
|
||||||
After=sound.target
|
|
||||||
Wants=network-online.target
|
|
||||||
After=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart={{ host_bin_path }}/spotifyd --no-daemon --config-path {{ spotifyd_config }}/spotifyd.conf
|
|
||||||
Restart=always
|
|
||||||
RestartSec=12
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
|
@ -1,31 +0,0 @@
|
||||||
$ANSIBLE_VAULT;1.1;AES256
|
|
||||||
65343335363561346563356238616135613332356235376332313035356163373838383237646338
|
|
||||||
6637616461383965316561323461393133336335643133350a663633613635383038326566363361
|
|
||||||
38613434346236656664343664376364366439333766646432393238376435306434393934663939
|
|
||||||
3332303365353838630a363165666662346366666335616435613636623962643631353365363861
|
|
||||||
64633639386136333931376134346238343437353366316162323061666334616565326566353264
|
|
||||||
38386464346464343164383264633461313534303537323964393364353361316565636236366566
|
|
||||||
39383833646666333733636233396439336138353861623735623466353365316463653464303061
|
|
||||||
38336431346130396133306362313063373630363031373165636262623839356538633639663534
|
|
||||||
62386333373633633236303065653239326330356136653535633633653136343534336331343338
|
|
||||||
66363438656332373932313466666135366232633732633963326564663365346361633865343635
|
|
||||||
37636336346365663661363563313330656230616230623833386463373133356461626436383166
|
|
||||||
31643934633439623462306639323730303431383339306662333431343566656265316662316264
|
|
||||||
63643932343032623162626133653833303431363831393564353539636134643234313630353131
|
|
||||||
32366130643730376162333238396365396666643130326139323235643137336364663332646161
|
|
||||||
35336233666561373730396330343734333433656630373235323130616531613035333963383262
|
|
||||||
66346262643962656161396536303363323866363638396534343237363737326631303330383262
|
|
||||||
39643064393364616565376433336530653630623036363631633465323236346432616439623731
|
|
||||||
37633737353964313834396133383661356364653665653364316433323261316164343032663162
|
|
||||||
61316538613361383464386239343932326465353664623639373533666532306133643337653262
|
|
||||||
30623330363462386636353266373539393865373938386338373662613237616335393535326539
|
|
||||||
63666161333465393931373438313232623232383032353932376363323566336631313239373837
|
|
||||||
39363034343662396538316336343230366432366231316631343434383266333532633363626331
|
|
||||||
38313931663438313562616266633262383235363438376137313266633561373363323962336432
|
|
||||||
64643965646636613034303638666632353637613232613539373533316438396661363161663064
|
|
||||||
63623361363537356562656334303139303935383434383461643830666561613463316537326362
|
|
||||||
61616433646532623834303734636162306232643233646664366161616134306636386134323237
|
|
||||||
61353635636634613732613434616564643038393836653937303036303462663534326331306535
|
|
||||||
30613334663763326230326563346462363764383132396539386464333466383230333039323762
|
|
||||||
65376632363639373861646632383135303663623634346339346361613739383664653834663431
|
|
||||||
3131373534383336623561653930363636396330336138323461
|
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
- name: install matt's SSH keys
|
|
||||||
tags:
|
|
||||||
- sshkeys
|
|
||||||
authorized_key:
|
|
||||||
user: matt
|
|
||||||
key: "{{ item }}"
|
|
||||||
state: present
|
|
||||||
with_file:
|
|
||||||
- public_keys/mdlayher_ed25519.pub
|
|
|
@ -1 +0,0 @@
|
||||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN5i5d0mRKAf02m+ju+I1KrAYw3Ny2IHXy88mgyragBN Matt Layher (mdlayher@gmail.com)
|
|
|
@ -1,2 +0,0 @@
|
||||||
[workstation]
|
|
||||||
test-ansible
|
|
|
@ -1,11 +0,0 @@
|
||||||
---
|
|
||||||
- hosts: workstation
|
|
||||||
become: true
|
|
||||||
become_user: root
|
|
||||||
roles:
|
|
||||||
- sshkeys
|
|
||||||
- golang
|
|
||||||
- node_exporter
|
|
||||||
- apcupsd
|
|
||||||
- apcupsd_exporter
|
|
||||||
- spotifyd
|
|
Loading…
Reference in a new issue