Commit Graph

1034 Commits (dynamic-inventory)

Author SHA1 Message Date
Dustin 60fa380e5d dyngroups: Always run all tasks
Adding the `always` tag to the tasks in `dyngroups.yml` ensures that
hosts will get added to the appropriate groups dynamically, even when
running a subset of tasks by targeting specific tags.  Ansible will
always run tasks with this tag when a tag selection is passed to
`ansible-playbook`.
2024-01-09 18:18:34 -06:00
Dustin 1226f1f005 hosts: Decommission mtrcs0.p.b
The Metrics Pi has bit the dust.  The NVMe disk has never been
particularly reliable, but now it's gotten to the point where it's a
real issue.  The Pi needs rebooted at least once a day.

I've moved the Victoria Metrics/Grafana ecosystem to Kubernetes.
2023-12-31 19:15:55 -06:00
Dustin ab30fa13ca file-servers: Set Apache ServerName
Since *file0.pyrocufflink.blue* now hosts a couple of VirtualHosts,
accessing its HTTP server by the *files.pyrocufflink.blue* alias no
longer works, as Apache routes unknown hostnames to the first
VirtualHost, rather than the global configuration.  To resolve this, we
must set `ServerName` to the alias.
2023-12-29 10:46:13 -06:00
Dustin fe258c51ac r/web/dcow: Proxy to Kubernetes
I've moved the Dark Chest of Wonders website to run in a container on
Kubernetes.  This will keep it from breaking every time the OS is
updated on the web server, when the version of Python in Fedora changes.
2023-12-17 20:16:51 -06:00
Dustin 3da74b8e53 ci: Add pipeline for file server 2023-12-04 13:59:48 -06:00
Dustin 00be022c04 ci: Add pipeline for Jellyfin 2023-12-04 12:20:39 -06:00
Dustin 5c297df6b9 r/gitea: use sshd_config.d
Recent(-ish) versions of Fedora have a drop-in configuration directory
for `sshd`.  This allows applications, etc. to define certain settings
for the SSH server, without having to manage the entire server
configuration.  For Gitea specifically, we only need to set a few
settings for the *gitea* user, leaving the remaining settings alone.

This commit does not include any migration to undo the settings that
were originally set,  but that should be as simple as `mv
/etc/ssh/sshd_config.rpmnew /etc/ssh/sshd_config && systemctl reload
sshd`.
2023-11-13 17:45:21 -06:00
Dustin dfd828af08 r/ssh-host-certs: Manage SSH host certificates
The *ssh-host-certs* role, which is now applied as part of the
`base.yml` playbook and therefore applies to all managed nodes, is
responsible for installing the *sshca-cli* package and using it to
request signed SSH host certificates.  The *sshca-cli-systemd*
sub-package includes systemd units that automate the process of
requesting and renewing host certificates.  These units need to be
enabled and provided the URL of the SSHCA service.  Additionally, the
SSH daemon needs to be configured to load the host certificates.
2023-11-07 21:27:02 -06:00
Dustin c3f58aff83 r/dch-yum: Configure dch Yum repository
The *dch* repository, hosted on *file0.pyrocufflink.blue* and managed by
the *repohost* Ansible role, is where I plan to host RPM packages for
internal use (e.g. *sshca-cli*, *dch-selinux*, etc.).  The *dch-yum*
role configures Yum/dnf to use this repository.  Roles that need to
install a package from here will list this role as a dependency.
2023-11-07 21:24:40 -06:00
Dustin c6f0ea9720 r/repohost: Configure Yum package repo host
So it turns out Gitea's RPM package repository feature is less than
stellar.  Since each organization/user can only have a single
repository, separating packages by OS would be extremely cumbersome.
Presumably, the feature was designed for projects that only build a
single PRM for each version, but most of my packages need multiple
builds, as they tend to link to system libraries.  Further, only the
repository owner can publish to user-scoped repositories, so e.g.
Jenkins cannot publish anything to a repository under my *dustin*
account.  This means I would ultimately have to create an Organization
for every OS/version I need to support, and make Jenkins a member of it.
That sounds tedious and annoying, so I decided against using that
feature for internal packages.

Instead, I decided to return to the old ways, publishing packages with
`rsync` and serving them with Apache.  It's fairly straightforward to
set this up: just need a directory with the appropriate permissions for
users to upload packages, and configure Apache to serve from it.

One advantage Gitea's feature had over a plain directory is its
automatic management of repository metadata.  Publishers only have to
upload the RPMs they want to serve, and Gitea handles generating the
index, database, etc. files necessary to make the packages available to
Yum/dnf.  With a plain file host, the publisher would need to use
`createrepo` to generate the repository metadata and upload that as
well.  For repositories with multiple packages, the publisher would need
a copy of every RPM file locally in order for them to be included in the
repository metadata.  This, too, seems like it would be too much trouble
to be tenable, so I created a simple automatic metadata manager for the
file-based repo host.  Using `inotifywatch`, the `repohost-createrepo`
script watches for file modifications in the repository base directory.
Whenever a file is added or changed, the directory containing it is
added to a queue.  Every thirty seconds, the queue is processed; for
each unique directory in the queue, repository metadata are generated.

This implementation combines the flexibility of a plain file host,
supporting an effectively unlimited number of repositories with
fully-configurable permissions, and the ease of publishing of a simple
file upload.
2023-11-07 20:51:10 -06:00
Dustin 6955c4e7ad hosts: Decommission dc-4k6s8e.p.b
Replaced by *dc-nrtxms.pyrocufflink.blue*
2023-10-28 16:07:56 -05:00
Dustin 420764d795 hosts: Add dc-nrtxms.p.b
New Fedora 38 Active Directory Domain Controller
2023-10-28 16:07:39 -05:00
Dustin a8c184d68c hosts: Decommission dc-ag62kz.p.b
Replaced by *dc-qi85ia.pyrocufflink.blue*
2023-10-28 16:07:08 -05:00
Dustin f334363aab r/samba-dc: sysvolsync: Remove winbind cache file
The `net cache flush` command does not seem to always work to clear the
identity mapping cache used by winbind.  Explicitly moving the file
does, though.
2023-10-28 09:56:44 -05:00
Dustin 3e70600691 r/samba-dc: sysvolsync: Fix running on fresh DC
On a new DC, the `idmap.ldb` file does not yet exist the first time
`sysvolsync` runs.  This causes a syntax error in the condition that
checks the modification timestamp of the file.
2023-10-28 09:52:24 -05:00
Dustin c814007c6d hosts: Add dc-qi85ia.p.b
New Fedora 38 domain controller.
2023-10-28 09:50:07 -05:00
Dustin 73499e3593 samba-dc: Do not apply sudo role
The *sudo* role should not be applied by the `samba-dc.yml` playbook.
It's not relevant to deploying Samba, and will just get applied by the
`domain-controller.yml` playbook later, anway.  Further, it fails when
a new domain controller is first provisioned, because at this step,
the system is not yet configured to resolve user IDs via winbind;
rather than add users to groups, it tries to create them.
2023-10-27 17:57:20 -05:00
Dustin 5bffdc68a2 r/samba-dc: sysvolsync: Use system DNS server
Forcing the PDC lookup to use localhost as the DNS server does not work
when first adding a new domain controller, as the `sysvolsync` script
runs before Samba starts.  There isn't much advantage to using the local
DNS server over the system-defined server anyway.
2023-10-27 17:55:44 -05:00
Dustin b45e647382 r/gitea: Update to v1.20.5 2023-10-27 17:41:43 -05:00
Dustin 431b7dfacc facts: Do not collect facts in first play
The first play in the `facts.yml` playbook contains a single task: clear
the existing fact cache.  It makes *no* sense to gather facts for this
play.
2023-10-27 17:40:50 -05:00
Dustin 7b23f6a4ac r/winbind: Disable offline login by default
The `winbind offline login` setting seems to cause issues when one of
the domain controllers is offline.  Rather than try the other DC,
winbind seems to just "give up" and return NT_STATUS_NO_SUCH_USER for
all authentication requests until the offline cache is flushed.  There's
not really any reason to use this setting on servers anyway, since they
are always connected to the LAN, as opposed to laptops that may
occasionally disconnect.  Let's disable this option in the hopes that it
makes logins more resilient to DC downtime.  After all, there's not much
point in having multiple DCs if they all have to be available in order
to log in.
2023-10-27 17:37:49 -05:00
Dustin 686817571e smtp-relay: Switch to Fastmail
AWS is going to begin charging extra for routable IPv4 addresses soon.
There's really no point in having a relay in the cloud anymore anyway,
since a) all outbound messages are sent via the local relay and b) no
messages are sent to anyone except me.
2023-10-24 17:27:21 -05:00
Dustin d2eb61cce1 r/sudo: Tag install tasks
Tasks that install packages need to be tagged as `install` so they can
be skipped by Jenkins daily runs.
2023-10-21 22:16:28 -05:00
Dustin 7c6ed667be r/system-auth: Tag install tasks
Tasks that install packages need to be tagged as `install` so they can
be skipped by Jenkins daily runs.
2023-10-21 22:16:28 -05:00
Dustin 6a6765ac06 r/system-auth: Remove uninstall authconfig task
The *authconfig* package has been gone from Fedora since ages.  There's
no reason to have this no-op step any more, especially since it has the
side-effect of making a network request to refresh the dnf cache.
2023-10-21 13:11:25 -05:00
Dustin 1b9543b88f metricspi: alerts: Increase Frigate disk threshold
We want the Frigate recording volume to be basically full at all times,
to ensure we are keeping as much recording as possible.
2023-10-15 09:52:12 -05:00
Dustin 2f554dda72 metricspi: Scrape k8s-aarch64-n1
I've added a new Kubernetes worker node,
*k8s-aarch64-n1.pyrocufflink.blue*.  This machine is a Raspberry Pi CM4
mounted on a Waveshare CM4-IO-Base A and clipped onto the DIN rail.
It's got 8 GB of RAM and 32 GB of eMMC storage.  I intend to use it to
build container images locally, instead of bringing up cloud instances.
2023-10-05 14:32:19 -05:00
Dustin a74113d95f metricspi: Scrape Zincati metrics from CoreOS hosts
Zincati is the automatic update manager on Fedora CoreOS.  It exposes
Prometheus metrics for host/update statistics, which are useful to track
the progress of automatic updates and identify update issues.

Zinciti actually exposes its metrics via a Unix socket on the
filesystem.  Another process, [local_exporter], is required to expose
the metrics from this socket via HTTP so Prometheus can scrape them.

[local_exporter]: https://github.com/lucab/local_exporter
2023-10-03 10:29:12 -05:00
Dustin d7f778b01c metricspi: Scrape metrics from k8s-aarch64-n0
*collectd* is now running on *k8s-aarch64-n0.pyrocufflink.blue*,
exposing system metrics.  As it is not a member of the AD domain, it has
to be explicitly listed in the `scrape_collectd_extra_targets` variable.
2023-10-03 10:29:11 -05:00
Dustin 50f4b565f8 hosts: Remove nvr1.p.b as managed system
*nvr1.pyrocufflink.blue* has been migrated to Fedora CoreOS.  As such,
it is no longer managed by Ansible; its configuration is done via
Butane/Ignition.  It is no longer a member of the Active Directory
domain, but it does still run *collectd* and export Prometheus metrics.
2023-09-27 20:24:47 -05:00
Dustin e4c2b36dfd r/scrape-collectd: Also scrape unmanaged targets
The `scrape_collectd_extra_targets` variable can be used to specify a
list of additional targets to scrape, in addition to the hosts in the
*collectd-prometheus* group.  This will allow us to scrape hosts that
are not managed by the configuration policy, but still expose Prometheus
metrics via collectd.
2023-09-27 20:24:47 -05:00
Dustin d3799607ec hosts: Move nvr1.p.b back to main inventory
*nvr1.pyrocufflink.blue* is no longer offline.
2023-09-26 07:40:33 -05:00
Dustin 0037a3c281 r/minio: Reload server after changing cert
MinIO is supposed to automatically reload itself when the certificate
changes, but this does not appear to happen in all cases.  To ensure the
updated certificate gets used, we need to send SIGHUP to the MinIO
server process.
2023-09-22 07:29:05 -05:00
Dustin 1b63332872 r/jellyfin: Restrict HTTPS redirect to Jellyfin
Since Jellyfin is running on the file server, which also hosts a few
other websites that do not define virtual hosts, the HTTP-to-HTTPS
redirect was applied to *all* requests.  To avoid this, we simply add a
rewrite condition so that the redirect only applies to requests for
Jellyfin.
2023-09-13 10:06:12 -05:00
Dustin a2b3f9b5b9 jellyfin: Deploy Jellyfin media server
Jellyfin is a multimedia library manager. Clients can browse and stream
music, movies, and TV shows from the server and play them locally
(including in the browser).
2023-09-12 13:38:35 -05:00
Dustin 226a6bef46 Revert "hosts: Move serial0.p.b offline"
This reverts commit 9d29961b38.
2023-08-07 11:41:06 -05:00
Dustin 9d29961b38 hosts: Move serial0.p.b offline
It seems this machine has died and probably needs to be rebuilt.
2023-07-26 11:49:46 -05:00
Dustin 16d05fcfb4 hosts: Move nvr1.p.b offline
This machine is offline until I get the cameras installed at the new
house.
2023-07-26 11:48:38 -05:00
Dustin 7120e4ebf8 hosts: Decommission hass2.p.b
Home Assistant is now hosted in Kubernetes.
2023-07-24 11:33:12 -05:00
Dustin 4cdb5dee70 certs/samba: Add missing symlink for dc-ag62kz.p.b 2023-07-24 08:36:20 -05:00
Dustin 7a9c678ff3 burp-server: Keep more backups
New retention policy:

* 7 daily backups
* 4 weekly backups
* 12 ~monthly backups
* 5 ~yearly backups
2023-07-17 16:36:37 -05:00
Dustin 06782b03bb vm-hosts: Update VM autostart list
* *dc2* is gone for a long time, replaced by two new domain controllers
* *unifi0* was recently replaced by *unifi1*
2023-07-07 10:05:22 -05:00
Dustin 6a5d1437e8 hosts: add unifi1.p.b
*unifi1.pyrocufflink.blue* is a Fedora machine that hosts the Unifi
Network controller software.
2023-07-07 10:05:01 -05:00
Dustin 71a43ccf07 unifi: Deploy Unifi Network controller
Since Ubiquiti only publishes Debian packages for the Unifi Network
controller software, running it on Fedora has historically been neigh
impossible.  Fortunately, a modern solution is available: containers.
The *linuxserver.io* project publishes a container image for the
controller software, making it fairly easy to deploy on any host with an
OCI runtime.  I briefly considered creating my own image, since theirs
must be run as root, but I decided the maintenance burden would not be
worth it.  Using Podman's user namespace functionality, I was able to
work around this requirement anyway.
2023-07-07 10:05:01 -05:00
Dustin 61844e8a95 pyrocufflink: Add Luma SSH keys for root
Sometimes I need to connect to a machine when there is an AD issue (e.g.
domain controllers are down, clocks are out of sync, etc.) but I can't
do it from my desktop.
2023-07-05 16:35:57 -05:00
Dustin 9f221cf734 web/dustinandtabitha: Disable RSVP form
The spammers have found our wedding RSVP form.
2023-06-27 09:02:54 -05:00
Dustin 0a68d84121 metricspi: Scrape hatchlearningcenter.org
To monitor site availability and certificate expiration.
2023-06-21 14:31:33 -05:00
Dustin 4e608e379f metricspi/alerts: Correct BURP archive alert query
When the RAID array is being resynchronized after the archived disk has
been reconnected, md changes the disk status from "missing" to "spare."
Once the synchronization is complete, it changes from "spare" to
"active."  We only want to trigger the "disk needs archived" alert once
the synchronization process is complete; otherwise, both the "disks need
swapped" and "disk needs archived" alerts would be active at the same
time, which makes no sense.  By adjusting the query for the "disk needs
archived" alert to consider disks in both "missing" and "spare" status,
we can delay firing that alert until the proper time.
2023-06-20 11:58:35 -05:00
Dustin b05edbf7fb r/minio: Configure firewall
The firewall needs to allow inbound connections to the MinIO HTTP API
and web UI ports.
2023-06-08 10:07:32 -05:00
Dustin 4776303db2 k8s-node: Deploy NFS client
Longhorn's new RWX (read-write many) mode requires the NFS client
utilities installed on the host machine.
2023-06-08 10:06:02 -05:00