Commit Graph

708 Commits (78f65355fab85d2ce63fcc7516c17c43651cd68a)

Author SHA1 Message Date
Dustin 6f9ff86788 r/homeassistant: Wait for network to start
Although Home Assistant itself will start fine if the network is not yet
available, some integrations will not.  Notably, the Matrix integration
will fail to load if it cannot contact the homeserver when it is first
initialized.  To avoid this problem, we can just delay starting Home
Assistant until the network is available.
2021-12-18 16:45:53 -06:00
Dustin 1f9e13a33b r/z*2mqtt: Wait for network before starting
The Zigbee2MQTT and ZWaveJS2MQTT servers do not start correctly if the
network is not yet available.
2021-12-18 16:45:52 -06:00
Dustin d446653296 homeassistant: Split out Zigbee/Zwave playbooks
To make it simpler to apply policy specifically for Zibgee2MQTT or
ZWaveJS2MQTT, I've split them into their own playbooks.
2021-12-18 16:45:52 -06:00
Dustin 74deb895ae pyrocufflink-dns: Remove dc0 forwarder
Decommissioning *dc0.pyrocufflink.blue*.  Do not forward requests for
internal domain names to it.
2021-12-18 16:44:48 -06:00
Dustin 62ca80a5f0 pyrocufflink-dns: Remove FireMon zones
There is no longer any point to having forward zones in the main DNS
server for FireMon domains, since we don't have a network-wide VPN
anymore.
2021-12-18 10:51:17 -06:00
Dustin 739ffb2845 home-assistant: Configure BURP backups
Take a snapshot of the history database first, then back up everything
in `/var/lib/homeassistant`.
2021-12-17 20:57:38 -06:00
Dustin fdfdaa6fe6 bitwarden_rs: Update burp backup path
Vaultwarden data are stored in a different location since the migration
to Podman.
2021-12-17 20:33:31 -06:00
Dustin 3f99708c48 cloud0: burp backup paths
Nextcloud data are no longer stored at `/var/www/html` since switching
to the Fedora-packaged distribution.
2021-12-17 20:22:42 -06:00
Dustin 80b267d6e5 r/burp: Enable progress counter for ad-hoc runs
Before the `burp` tool gained the `-Q` option, the only way to disable
the progress counter was through the configuration file.  Since we do
not want any output from automatic backups (except of course
catastrophic failures), since it would end up being e-mailed by cron,
the progress counter had to be disabled globally.  This meant that
on-demand runs on a terminal could not have a progress counter, which
was pretty disappointing.

Now that `burp` has `-Q`, this is no longer the case.  Scheduled backups
can run with `-Q`, but ad-hoc runs can omit it to get a progress
counter.
2021-12-17 20:19:30 -06:00
Dustin b62f08ccd4 ci: gitea: Convert to cfgpol shared library 2021-11-13 09:49:24 -06:00
Dustin 9fab49928d ci: Update container image to Fedora 34 2021-11-09 18:07:59 -06:00
Dustin 9d3c5c0da7 samba-dc: Apply to one machine at a time
Avoid accidentally taking down the whole domain with a bad task.  It'll
fail on one DC and never change the other(s).
2021-11-07 16:20:03 -06:00
Dustin 948079dafa r/samba-dc: Configure samba logging
Send logs to the systemd journal for easier viewing and disable logging
to a file.  Also, the `samba_dc_log_level` variable can control the log
level (0-10, 0 being off, 10 being insane debugging).
2021-11-07 16:18:51 -06:00
Dustin 14c7b1fcc1 bitwarden_rs: Update collectd process name
`bitwarden_rs` is now named `vaultwarden`.
2021-11-06 19:42:07 -05:00
Dustin e3b5b4d5ff r/bitwarden_rs: Migrate to podman
Docker is effectively deprecated by Fedora/Red Hat.  It is a pain in the
ass to work with anyway.  Podman integrates better with systemd, and is
in general more aligned with how I prefer to deploy and manage
applications.

I am following the same pattern here that I have used for Home
Assistant, ZWaveJS2MQTT, etc.  The systemd service starts the container
with `podman`, passing the necessary arguments for UID/GID mapping, etc.
Note that, by default, Vaultwarden expects to be able to bind to port
80; since the container is unprivileged, we have to configure it (or
rather, its embedded HTTP server [Rocket](https://rocket.rs)) to listen
on a different port.  We also configure it to listen only on the
loopback, since it is being proxied by Apache to the outside network.

To migrate the data from the Docker volume, we just have to copy the
files and fix their ownership.

The *bitwarden_rs* project was recently renamed to *Vaultwarden*, so I
took this opportunity to update the name in most places within the
*bitwarden_rs* role.
2021-11-06 19:33:33 -05:00
Dustin 9f41f239e2 ci: Fix remount r/o stage name 2021-11-06 18:15:02 -05:00
Dustin d39b2bcb19 r/winbind: Add domain-join tag
Sometimes I need to configure a machine to be a domain member without
actually adding it to the domain.  Now I can by running
`ansible-playbook` with `--skip-tags domain-join`
2021-11-06 18:12:29 -05:00
Dustin 3f9b8c1d9b r/vmhost: Install libvirt storage driver
The *libvirt-daemon-driver-storage-core* package provides the libvirt
plugin needed for storage management, e.g. `virsh blockresize`.
2021-11-06 18:10:32 -05:00
Dustin 150798cbd5 ci: Clear fact cache before every run
Since the `remount.yml` playbook now tries to avoid redundant remounts,
it needs up-to-date facts about mounted filesystems and their options.
If the cached facts are out of date, it may incorrectly skip remounting
a filesystem.  Besides, having up-to-date facts in the CI pipeline is
probably a good thing anyway.
2021-11-02 07:30:00 -05:00
Dustin 7bb1eb677e r/samba-dc: Use rfc2307 on all DCs
I honestly don't remember why the `use rfc2307` setting was only enabled
on the first DC.  All DCs seem to need this setting in order to use the
UID/GID numbers from the directory, instead of using auto-generated
numbers.
2021-10-31 21:07:49 -05:00
Dustin 803fd5ef2a r/systemd-networkd: Enable and start the service
Obviously, the *systemd-networkd* service needs to be running in order
for it to manage the network connections.
2021-10-31 14:29:30 -05:00
Dustin c882ac45e7 nut: Add playbook for NUT
NUT runs on *serial0.pyrocufflink.blue* and monitors the two UPSes on
the server rack.
2021-10-31 14:28:27 -05:00
Dustin ff7c58ae71 r/collectd-nut: Configure nut plugin for collectd
The *nut* plugin for *collectd* fetches data from Network UPS Tools.
This is useful for monitoring UPS statistics over time.
2021-10-31 14:26:26 -05:00
Dustin 4beade5465 r/nut: Add role for Network UPS Tools
The *nut* role installs and configures Network UPS Tools.
2021-10-31 14:25:59 -05:00
Dustin 19330ac555 r/protonvpn: watchdog: reconfigure at startup
If the remote address configuration for strongSwan is not valid when the
Proton VPN watchdog starts, it will now regenerate it immediately.  This
can happen, for example, if the Internet has been down for a while, and
the watchdog has iterated through all of the servers in the cache.
Restarting the service will now force it to reconfigure the tunnel and
bring the VPN back up.
2021-10-31 01:24:52 -05:00
Dustin 328f2fa586 hosts: Set up collectd/Prometheus on vmhosts
The groups in `hosts.offline` need to match those in `hosts`.
Specifically, the *collectd* group needs to be a child of the
*collectd-prometheus* group so that the *write_prometheus* plugin is
installed and configured on hosts defined in this inventory file.
2021-10-31 01:13:50 -05:00
Dustin 6c705f54af hosts: vmhost1: Switch to systemd-networkd
Using *systemd-networkd* to configure network interfaces on *vmhost0* is
working really well.  It is decidedly more stable than *dhcpcd* was, and
certainly easier to work with than NetworkManager.  Let's go ahead and
switch *vmhost1* as well.
2021-10-31 01:12:25 -05:00
Dustin d3592f1162 hosts: Add serial0.pyrocufflink.blue
This is a Raspberry Pi 3 on the DIN rail that has USB-to-RS232 adapters
connected to the VM hosts and the Firewall.
2021-10-31 00:54:10 -05:00
Dustin a178dc4af9 r/collectd-version: Add OS version plugin
The `collectd-version` script uses the *collectd* UNIX socket to send
custom values to *collectd* to track the OS version.  Since these values
obviously cannot change while the system is running, the values are
specified with a very long interval.  This avoids having to continuously
insert the values, either with a long-running process or by repeatedly
running a script.  The values only need to be inserted once when
*collectd* starts.
2021-10-30 16:50:37 -05:00
Dustin 12c3fb950b r/collectd: Add custom types database
All values sent to *collectd* must have an associated type.  The type
defines the acceptable range of values.  Types are defined in a simple
text file database.  *collectd* loads all of the databases specified by
`TypesDB` directives in its configuration file.  When configuring a
custom types database, the default database needs to be specified
explicitly; it will not be loaded automatically if there are any
`TypesDB` directives in the configuration.
2021-10-30 16:47:29 -05:00
Dustin 32d1e0ff6f r/collectd: Enable unixsock plugin
The *unixsock* plugin for *collectd* provides a socket-based interface
that other software can use to communicate with *collectd*.  Notably,
this can be used to publish custom values, query existing values, and
flush caches.

The socket is created at `/run/collectd/socket`.  The `/run/collectd`
directory is managed by systemd; it will be created automatically when
the service starts and cleaned up when it stops.
2021-10-30 16:46:01 -05:00
Dustin 98401b3c1e remount: Only remount if needed
Skip remounting filesystems that are already in the specified state.
2021-10-30 16:41:58 -05:00
Dustin 689d53abfd r/collectd: Disable network plugin by default
The default configuration for *collectd* no longer needs the network
plugin enabled, as hosts are scraped directly by Prometheus now.
2021-10-30 16:41:17 -05:00
Dustin 881c8de625 Switch Prometheus/collectd to pull
Transitioning from push-based to pull-based monitoring with
Prometheus/collectd.  The *write_prometheus* plugin will be installed on
all hosts, and Prometheus will be configured to scrape them directly.
2021-10-30 16:41:17 -05:00
Dustin b78af05fd8 r/collectd-prometheus: Allow scraping from outside
The *collectd-prometheus* role now has a
`collectd_prometheus_allow_outsize` variable.  This variable controls
whether or not external hosts are allowed to scrape data from *collectd*.
When set to `false`, as is the default value, *collectd* will be
configured to listen on the loopback interface only, and the TCP port
will not be opened in the firewall.
2021-10-30 16:41:17 -05:00
Dustin 3127b9b8f7 r/synapse: Enable Prometheus metrics
Synapse supports exporting metrics in Prometheus format.  It can do this
either as part of the main server, or in a separate listener.  I chose
to use a separate listener so that the metrics are not exposed
publicly.
2021-10-18 18:08:50 -05:00
Dustin 6df0d7bea4 r/gitea: Enable Prometheus metrics
Gitea provides a Prometheus-compatible metrics endpoint at `/metrics`,
but it is disabled by default.
2021-10-18 10:11:44 -05:00
Dustin d8919f6424 hosts: dns0: Allow DDNS updates from gw1
Since the firewall is now the DHCP server, the DNS server needs to allow
it to send DDNS updates for *pyrocufflink.red*.
2021-10-17 14:12:19 -05:00
Dustin 86aa292931 hosts: Remove dc2 from ntpd group
Fedora 34 does not include the *ntp* package, as it has been "obsoleted
by ntpsec."  Until I can create a role for *ntpsec*,
*dc2.pyrocufflink.blue* cannot be an NTP server.
2021-10-17 14:11:00 -05:00
Dustin 8eeccc0f65 hosts: dc2: Add RADIUS server certificate 2021-10-17 14:03:52 -05:00
Dustin 93bf6593d7 r/collectd: Add missing processes.conf template
I forgot to `git add` the template file.
2021-10-17 09:13:34 -05:00
Dustin f3c4b4d174 Merge remote-tracking branch 'refs/remotes/origin/master' 2021-10-16 21:54:36 -05:00
Dustin 8e9699810b burp-server: Monitor burp process with collectd 2021-10-16 21:53:51 -05:00
Dustin e2c5549f35 hosts: Add dc2.p.b
*dc2.pyrocufflink.blue* acts as a second Active Directory Domain
Controller with *samba*.
2021-10-16 21:53:02 -05:00
Dustin 8e35c57f53 samba-dc: Monitor processes with collectd
Monitor the state of Samba server processes via the *processes* plugin
for *collectd*.
2021-10-16 16:33:23 -05:00
Dustin d032e1b89d bitwarden_rs: Monitor processes with collectd
Monitor the state of the `bitwarden_rs` server process via the
*processes* plugin for *collectd*.
2021-10-16 16:32:22 -05:00
Dustin 3e08588d98 collectd: Configure the processes plugin
The *processes* plugin for collectd can be configured to monitor
additional information about specific processes.  By specifying one or
more `Process` or `ProcessMatch` directives in the plugin configuration,
collectd will start monitoring the listed processes in detail.

The `collectd_processes` Ansible variable can contain a list of
processes to monitor.  Each item must at least have a `name` property,
and may also have a `regex` property.  If the latter is present, a
`ProcessMatch` directive will be emitted instead of a `Process`
directive.
2021-10-16 16:25:02 -05:00
Dustin 014043909a vm-hosts: Enable multicast querier on bridge
Having this option enabled dramatically improves the reliability of
collectd multicast traffic from physical machines and VMs on a separate
VM host from the receiving machine.
2021-10-16 16:12:15 -05:00
Dustin ce0dac983f pyrocufflink: Set root password and SSH keys
1. Set a password for *root* on all machines (useful for logging in via
   serial console if network is down)
2. Set an authorized SSH key for root on all machines:

   * For Fedora 34, use my FIDO2 security token key
   * For all other hosts, use my ED25519 key
2021-10-16 15:40:20 -05:00
Dustin d6fff04985 r/base: Set SSH authorized keys for root
To ensure all machines have the same keys to allow root to log in via
SSH (in case Active Directory is unavailable or something).
2021-10-16 15:39:19 -05:00