Commit Graph

655 Commits (4511d5447ec99cb7369ade600a16e9508f590c33)

Author SHA1 Message Date
Dustin ad96dc2757 r/collectd: Manage collectd.d directory
The `/etc/collectd.d` directory is created by the RPM package on
machines running a Red Hat-based Linux distribution, but it may not
always be present on other machines.
2022-08-10 19:47:12 -05:00
Dustin a357b5dc08 r/ssh-hostkeys: Add SSH keys for K8s nodes
I forgot to add the SSH host keys for the nodes in the Kubernetes
cluster when I first added them to the inventory.
2022-08-10 19:47:12 -05:00
Dustin c48cc985b2 r/collectd: Ignore filesystems by path
In addition to ignoring particular types of filesystems, e.g. OverlayFS,
we can also ignore filesystems by their mount point.  This could be
useful, for example, for bind-mounted directories, such as those used on
Kubernetes nodes.
2022-08-05 18:56:48 -05:00
Dustin 8cab0b368e r/collectd: Ignore overlay filesystems
By default, the *df* pluggin for collectd, which monitors filesystem
usage, collects data about all mounted filesystems.  It can be
configured to ignore some filesystems, either by mount point, device, or
filesystem type.  We will uses this capability to avoid collecting data
about OverlayFS mounts, because by definition, they do not represent a
real filesystem, but one or more other mounted filesystems.  Collecting
data about these just creates useless metrics, especially on machines
that run containers.
2022-08-03 21:21:28 -05:00
Dustin 870baa3fcf remount: Remount read/write by default
Setting the `remount_state` variable to `rw` by default will allow the
`remount.yml` playbook to be "chained" with other playbooks, e.g.:

```
ansible-playbook -l kubelet remount.yml collectd.yml -b
```
2022-08-03 20:57:05 -05:00
Dustin 1214b507c5 r/collectd-prometheus: Skip firewalld tasks
Some machines, such as the nodes in the Kubernetes cluster, do not use
*firewalld*.  For these machines, we need to skip the `firewalld` tasks,
as they will fail.  The `host_uses_firewalld` variable can be set to
`False` for these machines to do so.
2022-08-03 20:57:05 -05:00
Dustin c8e89a4b16 hosts: Add Kubernetes machines
There is no specific playbook or role for Kubernetes.  All OS
configuration is done at install time via kickstart scripts, and
deploying Kubernetes itself is done (manually) using `kubeadm init` and
`kubeadm join`.
2022-08-03 20:52:01 -05:00
Dustin 3b692a9de8 vm-hosts: Add Kubernetes VLAN configuration 2022-08-03 20:51:33 -05:00
Dustin 6f95a595b2 hosts: Add nvr1.p.b to rw-root group
*nvr1.pyrocufflink.blue* has a single btrfs filesystem which cannot be
mounted read-only.
2022-07-24 16:44:06 -05:00
Dustin c9dbaa32b9 collectd: Control SELinux domain permissiveness
It seems with each new release of Fedora, some feature or other of
*collectd* gets broken.  In Feodra 36, the *interfaces* plugin does not
seem to work reliably, and the *md* plugin logs a *lot* of errors.
While these issues are investigated upstream, we either need to manage
our own policy for collectd or mark the `collectd_t` domain permissive.
I chose the latter because I'm lazy and I don't consider collectd to be
that big of a threat to security.
2022-07-24 10:35:32 -05:00
Dustin 6f11a4cf3a grafana: Set Grafana domain
Necessary for Grafana CSRF protection.
2022-07-24 10:31:46 -05:00
Dustin be4bbc0092 r/grafana: Fix Origin not allowed error
Grafana 8.3.5 introduced a new CSRF protection mechanism that requires
the value of the Host HTTP request header to be preserved from the
original client request.

https://github.com/grafana/grafana/issues/45117#issuecomment-1033842787
2022-07-24 10:07:45 -05:00
Dustin 3e8da609e7 frigate: Keep front porch recordings for 2 days
Now that there is plenty of storage in the new video server, let's keep
24/7 recordings from the front porch camera, too.
2022-07-23 17:52:26 -05:00
Dustin 797cc2092f hosts: Add nvr1.p.b
*nvr1.pyrocufflink.blue* is the new video recording server.  It is a
1U rack-mounted physical machine based on the [Jetway
JBC150F596-3160-B][0] barebone system.  It replaces
*nvr0.pyrocufflink.blue* in this role.

[0]: https://www.jetwaycomputer.com/JBC150F596.html
2022-07-23 17:52:26 -05:00
Dustin eb79f6ea83 r/frigate: Work around podman/netavark lock
Podman 4 puts lock files in the configuration directory for [some stupid
reason][0].  There are so many issues here!

* It is now impossible to run `podman` as root with a read-only `/etc`.
* Why does it need the lock file at all when using `--network=host`?

Luckily, we can work around it fairly easily by mounting a tmpfs
filesystem over the directory it wants to put the lock file in.  This
pretty much defeats the purpose of having a lock file, but it's likely
not needed anyway.

[0]: 836fa4c493
2022-07-23 17:43:54 -05:00
Dustin c1c28a51b5 frigate: Use native MQTT/TLS support
Frigate has native support for MQTT over TLS now, so there is no more
any need to use stunnel.
2022-07-23 17:27:02 -05:00
Dustin d5ef18ccc3 frigate: Split camera config into separate file
This will make it easier to manage Frigate camera settings.
2022-07-23 17:26:19 -05:00
Dustin ee0e6873ad r/collectd-sensors: Install collectd sensors plugin
The *sensors* plugin for collectd reads temperature information from the
I²C/SMBus using *lm_sensors*.  Naturally, it is only useful on physical
machines, so it is not installed or enabled by default.
2022-07-21 13:14:25 -05:00
Dustin 87e24aba3f hosts: hass2.p.b: Enable collectd thermal plugin
This plugin reads Raspberry Pi SoC temperature data.
2022-07-21 12:37:16 -05:00
Dustin a60327a995 r/collectd: Allow the thermal plugin
Raspberry Pi devices provide SoC temperature information through thermal
zone data in sysfs.
2022-07-21 12:37:07 -05:00
Dustin 29a6a0540f r/collectd: Better control over enabled plugins
Instead of a simple list of disabled plugins, hosts and host groups can
now control whether plugins are enabled or disabled using the
`collectd_plugins` map.  The map keys are plugin names, and the values
are booleans indicating if the plugin is enabled.

Using this mechanism, some plugins can be disabled by default (e.g. the
*md* plugin), and enabling them per host or per host group is simpler.
2022-07-21 12:22:19 -05:00
Dustin c7ca8e5b15 r/collectd: Allow enabling the md plugin
The *md* plugin monitors Linux multi-disk RAID (*mdraid*) devices.
2022-07-21 12:22:19 -05:00
Dustin 41582beef9 group_vars/frigate: Add second back yard camera
Adding a second camera to the back yard, on the North side of the porch,
to try and figure out how the possums keep getting under the porch even
with the chicken wire around it!
2022-07-18 18:25:20 -05:00
Dustin 82f9ce0797 group_vars/frigate: Keep back yard recordings
We're trying to discover how the possums are getting into and out of the
house.  Let's enable continuous video recording from the back yard
camera so we can observe them and come up with a plan to get rid of
them.
2022-07-18 18:20:21 -05:00
Dustin 14332a4c3e remount: Clear facts
Cached facts interfere with the detection of which filesystems need to
be remounted.  We need to clear them all and gather again before
beginning to ensure that the correct mounts are considered.
2022-07-18 18:05:03 -05:00
Dustin 5f6e2e774c hosts: Remove build2-armv7hl
This machine has a hardware problem.
2022-07-05 20:30:19 -05:00
Dustin a3608f187c home-assistant: Enable Mosquitto persistence
Configuring Mosquitto to persist its state to the filesystem will keep
retained messages from MQTT sensors, etc.
2022-05-29 11:26:39 -05:00
Dustin e7534d36cf r/mosquitto: Support persistence
Mosquitto can save retained messages, persistent clients, etc. to the
filesystem and restore them at startup.  This allows state to be
maintained even after the process restarts.
2022-05-29 11:25:25 -05:00
Dustin 24228953b0 r/samba-dc: Configure logrotate for KDC
The KDC service, as managed by Samba, continuously logs to two files
that need to be rotated.  The upstream configuration for logrotate only
manages one of these files, and does not correctly signal the service
after rotating, as it expects the service to be managed by systemd
instead of Samba.  As such, we need to adjust the configuration to
handle both files and send SIGHUP directly to the process.
2022-04-24 11:37:13 -05:00
Dustin d363026db2 websites: dustin.hatch.name: Deploy new site
Promoting the new site I have been working on at *dustin.hatch.is* to my
main domain, *dustin.hatch.name*.  The new site is just static content,
generated and uploaded by a Jenkins job.

Finally have a certificate for *dustin.hatch.name* now, too!
2022-04-23 15:30:40 -05:00
Dustin 3c8e576841 grafana: Enable anonymous access
Allow unauthenticated users to view dashboards.  Useful for Heads-Up
Displays.
2022-03-07 20:10:13 -06:00
Dustin 5e2cfee8a1 r/protonvpn: watchdog: Improve error handling
This resolves two issues with fetching the Proton VPNserver list:

1. If a connection error occurs when fetching the list, it will be
   ignored, just as with HTTP errors
2. If any errors are encountered when fetching the list, and a valid
   cache was loaded, its contents are returned, regardless of the
   timestamp of the cache file.
2022-03-01 21:28:21 -06:00
Dustin 5485fc6f93 websites/d…and…t: Configure formsubmit
To handle the RSVP form on *dustinandtabitha.com*, we are going to use
*formsubmit*.  It runs on the same machine that hosts the website, so
there's no dealing with CORS.  The */submit/rsvp* path, which is proxied
to the backend, is the RSVP form's target.
2022-02-27 17:56:54 -06:00
Dustin b350698148 r/formsubmit: Deploy formsubmit app
*formsubmit* is a simple, customizable HTML for submission handler.  I
designed it for Tabitha to use to collect information from forms on her
websites.  Notably, we will use it for the RSVP page on our wedding
invitation site.
2022-02-27 17:42:15 -06:00
Dustin 3632698f37 websites/dustinandtabitha.com: Add role
Wedding website 😍
2022-02-27 17:41:40 -06:00
Dustin 6f29235387 burp: Add missing client password for hass2 2022-01-22 12:19:47 -06:00
Dustin c12da40228 home-assistant: Correct BURP exclude syntax
BURP does not support relative paths or globs in `exclude` values.
2022-01-16 10:08:27 -06:00
Dustin 5efbee725e home-assistant: Omit history DB from backups
The state history database is entirely too big.  It takes over an hour
to create a backup of it, which usually causes BURP to time out.  The
data it stores isn't particularly interesting anyway.  Instead of trying
to back it up and ultimately not getting any backup at all, we'll just
skip it altogether to ensure we have a consistent backup of everything
else that is actually important.
2022-01-02 12:07:12 -06:00
Dustin d8bb629c5d r/frigate: Ensure service starts at boot
Missing a task to enable the *frigate.service* unit meant that the
service would not start automatically when the machine booted.
2021-12-30 09:35:14 -06:00
Dustin 2b27a31bee frigate: Update config syntax for 0.9.x
There were several backward-incompatible changes introduced in Frigate
[0.9.0](https://github.com/blakeblackshear/frigate/releases/tag/v0.9.0).
Notably, recordings and clips are now configured together.
2021-12-30 09:33:58 -06:00
Dustin 952050e326 certs/samba: dc2: Add CA chain
The intermediate CA certificate was not included in the certificate file
used by Samba, so LDAP/TLS connections would fail with a trust
validation error.
2021-12-23 11:44:30 -06:00
Dustin dfa61c8a73 r/nextcloud: Increase Apache timeout
Uploading large files can take a very long time.  If the process takes
longer than the configured timeout in Apache, it will be aborted and the
client will receive an HTTP 504 Gateway Timeout error.  Increasing the
timeout will help alleviate this for files up to a certain size.
Notably, it now lets me upload Signal backups without errors.
2021-12-22 11:28:52 -06:00
Dustin 6acb25e309 nextcloud: Trust headers from public rev proxy
If Nextcloud does not have the Internet-facing reverse proxy listed in
its "trusted proxies" setting, it will mark all traffic as being from
the proxy itself.  This breaks brute force detection, etc.
2021-12-20 22:20:09 -06:00
Dustin 7d7dda6061 r/nextcloud: Dynamically set version in config
Nextcloud thinks it needs to run the upgrade/migration tool if the
version number in its configuration file does not match the running
version.  It then updates the config file with the correct version. The
next time the configuration policy is applied, however, the version will
revert back to whatever is set in the template.  This will re-trigger
the upgrade notification.

To avoid this problem, we now set the version in the configuration file
dynamically.  Nextcloud writes its version number in a constant in
`version.php`.
2021-12-20 22:18:14 -06:00
Dustin 7ab3787798 r/nextcloud: Correct memcache config syntax
Nextcloud uses double backslashes in its fully-qualified path names.
Although single backslashes work, the application will replace them,
leading to a constant conflict between itself and the Ansible template.
2021-12-20 22:15:53 -06:00
Dustin e55fc8f5af r/homeassistant et al.: Increase start timeout
The first time launching a container after pulling a new image, it can
take several minutes for the container to actually start.  Podman has to
set up the overlay filesystems, which is very slow on a Raspberry Pi.

With the default start timeout, systemd may end up killing the process
before the container is completely set up.  Thus, we need to increase
the timeout to ensure there is plenty of time for Podman to work.
2021-12-20 09:59:14 -06:00
Dustin f8e3bdade0 r/z*2mqtt: Fix device node contexts at start
Processes running in containers only have access to a limited set of
devices, based on their SELinux type label.  The USB serial devices
exposed by the Zwave and Zigbee adapters are not labelled correctly by
default to allow them to be used in containers.

Using `chcon` to change the type label of the device before starting the
container seems to work, but seems a bit kludgy.  It would probably be
better to use a SELinux file context rule and/or a udev rule to ensure
the label is set correctly when the device node is created.
2021-12-18 16:45:53 -06:00
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