Compare commits

..

40 Commits

Author SHA1 Message Date
unkin-agent cb1a0ff083 Label dind runner nodes without a taint
ci/woodpecker/pr/ruby-validate Pipeline was successful
ci/woodpecker/pr/bolt-validate Pipeline was successful
ci/woodpecker/pr/erb-validate Pipeline was successful
ci/woodpecker/pr/puppet-lint Pipeline was successful
ci/woodpecker/pr/yamllint Pipeline was successful
ci/woodpecker/pr/epp-validate Pipeline was successful
ci/woodpecker/pr/ruby-check Pipeline was successful
ci/woodpecker/pr/puppet-validate Pipeline was successful
2026-11-27 06:56:57 +11:00
unkin-agent 3edc8697b1 Dedicate prodnxsr0014 and prodnxsr0019 to the dind runner pool
ci/woodpecker/pr/ruby-validate Pipeline was successful
ci/woodpecker/pr/puppet-lint Pipeline was successful
ci/woodpecker/pr/bolt-validate Pipeline was successful
ci/woodpecker/pr/erb-validate Pipeline was successful
ci/woodpecker/pr/yamllint Pipeline was successful
ci/woodpecker/pr/epp-validate Pipeline was successful
ci/woodpecker/pr/ruby-check Pipeline was canceled
ci/woodpecker/pr/puppet-validate Pipeline was canceled
2026-11-27 06:54:36 +11:00
unkin-agent 12dd9a5155 Add iuclabs-tools yumrepo (#587)
GitHub-released RPMs (dns-updater, soon node-lookup) reach artifactapi only via the iuclabs-tools virtual repo, and no host has a yumrepo for it, so `ensure => latest` never sees new releases.

- Add an `iuclabs-tools` yumrepo to AlmaLinux and Fedora hieradata, mirroring rpm-internal (gpgcheck false, metadata_expire 60)
- baseurl: `/api/v1/virtual/iuclabs-tools/`; verified with dnf from almalinux:9 (dns-updater 0.1.4 available)

---------

Co-authored-by: BenVincent <benvin@main.unkin.net>
Reviewed-on: #587
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-26 23:14:22 +11:00
unkin-agent cc5d2d872d Add iuclabs-tools yumrepo (#587)
GitHub-released RPMs (dns-updater, soon node-lookup) reach artifactapi only via the iuclabs-tools virtual repo, and no host has a yumrepo for it, so `ensure => latest` never sees new releases.

- Add an `iuclabs-tools` yumrepo to AlmaLinux and Fedora hieradata, mirroring rpm-internal (gpgcheck false, metadata_expire 60)
- baseurl: `/api/v1/virtual/iuclabs-tools/`; verified with dnf from almalinux:9 (dns-updater 0.1.4 available)

Reviewed-on: #587
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-26 22:47:31 +11:00
unkin-agent 869821e73f Remove reposync roles and profiles (#586)
The packagerepo stack (syncer ausyd1nxvm2058, repo nodes 2059-2061) is being decommissioned and packagerepo.service.consul has no remaining consumers, so its roles, profiles and hieradata are dead code.

- remove roles::infra::reposync::{repo,syncer}
- remove profiles::reposync::* with its templates and files
- remove hieradata/roles/infra/reposync role data

Merge after terraform-incus decommission of ausyd1nxvm2058-2061 is applied.

Reviewed-on: #586
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-25 22:36:25 +11:00
unkin-agent 6cf396ced8 Drop packagerepo puppet yumrepo fallback (#585)
packagerepo.service.consul is being decommissioned, but profiles::puppet::agent still declares a `puppet` yumrepo pointing at it whenever openvox_enable is false. Every RedHat-family node already runs OpenVox, so the toggle and fallback are dead weight.

- select the agent package by OS family: openvox-agent on RedHat, puppet-agent on Debian
- manage the openvox yumrepo for all RedHat-family nodes
- remove the packagerepo `puppet` yumrepo and the openvox_enable param
- drop openvox_enable from AlmaLinux and Fedora hieradata

Reviewed-on: #585
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-25 22:33:39 +11:00
unkin-agent c6e411a027 fix(nginx): drop hostname from journald syslog targets (#584)
nginx's syslog output puts the hostname between the timestamp and the tag. journald's /dev/log parser expects the tag directly after the timestamp, so SYSLOG_IDENTIFIER is never set and the hostname and tag stay in MESSAGE.

- add `nohostname` to every `syslog:server=unix:/dev/log` access and error log target

Reviewed-on: #584
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-24 23:30:19 +11:00
unkin-agent 89bd97048e Send nginx logs to journald (#583)
nginx only logs to files, so its access and error logs never reach journald or VictoriaLogs, and proxy errors (e.g. consul.service.consul 502s) can't be diagnosed from vlogs.

- add a `journald` log_format with `$host`, request time and upstream addr/status/response time
- add syslog (`unix:/dev/log`) targets estate-wide: `tag=nginx_access` for access, `tag=nginx` for errors
- add the same syslog targets to the per-vhost logs in simpleproxy, edgecache, reposync, certbot and puppetboard, keeping the existing files

Reviewed-on: #583
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-24 21:32:06 +11:00
unkin-agent e057ca9147 Raise consul nginx proxy_read_timeout to 360s (#582)
OpenTofu's consul backend holds its state lock via blocking KV GETs that use consul's default 5m wait (plus up to wait/16 jitter). The consul.service.consul proxy uses the nginx module's 90s proxy_read_timeout, so nginx 504s the long-poll and the lock is lost mid-apply.

- set nginx::proxy_read_timeout to 360s for the consul role

Reviewed-on: #582
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-23 21:35:54 +11:00
unkin-agent 81262ee73e feat: export router ntopng timeseries to vmagent (#580)
ntopng on the router keeps its nDPI timeseries in local RRDs, so they never reach Grafana. vmagent already accepts InfluxDB line protocol over HTTPS without auth, and ntopng can write to it directly.

- set `profiles::metrics::ntopng::influx_url` to `https://vmagent.k8s.syd1.au.unkin.net` for the router role, which switches the driver to influxdb with db `ntopng`

Reviewed-on: #580
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-17 22:11:21 +11:00
unkin-agent 7682c654c0 feat: add ntopng passive DPI to the router role (#578)
Per-app traffic visibility (Netflix, Instagram, email, etc.) in Grafana needs nDPI classification at the router, which ntopng Community provides passively.

- add profiles::metrics::ntopng: package, ntopng.conf, local redis, service
- capture WAN + LAN interfaces; web UI on 127.0.0.1:3000 only
- keep timeseries interface-level (nDPI protocol + category), per-host off
- export to InfluxDB-compatible VictoriaMetrics when `influx_url` is set
- add ntop + ntop-noarch artifactapi repos, enabled for the router role only

Requires terraform-artifactapi #79 merged first.

Reviewed-on: #578
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-17 21:58:34 +11:00
unkin-agent f6f93d855e Collect kernel audit records in journald (#579)
EL drops systemd-journald-audit.socket from journald's Sockets=, so kernel audit records never reach the journal or the victorialogs upload. journald only picks up listen fds at start, so the drop-in needs a restart to apply.

- add a systemd-journald drop-in listing the audit socket when journald upload is enabled
- remove the drop-in when upload is disabled
- restart journald on drop-in add or removal via the drop-in notifying the service puppet-systemd already manages

Reviewed-on: #579
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-17 21:45:03 +11:00
unkin-agent 42c4e41508 Allow systemd-journal-upload through SELinux (#577)
systemd-journal-upload never ships logs on SELinux-enforcing hosts: policy denies `systemd_journal_upload_t` `name_connect` to `http_port_t` (443), so uploads to VictoriaLogs fail.

- add local `journal_upload_local` SELinux module to `victorialogs::client::journald` on enforcing hosts
- order the module before `Service[systemd-journal-upload]`

Reviewed-on: #577
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-15 19:03:15 +11:00
unkin-agent bd126a0d1e Slim networkctl fact (#576)
The networkctl fact dumps every raw `networkctl --json=short` field, route and interface (including CNI veths), with addresses as byte arrays, pushing facter past its 4096 fact value limit.

- skip links networkd does not manage
- keep only state, type, MTU and config file fields per link
- render MAC and IP addresses as strings, drop routes and empty dropins
- return nil when no managed links exist

Reviewed-on: #576
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-15 18:55:12 +11:00
unkin-agent 9a4dbd82ac frrouting: exclude prefixes from connected redistribution (#575)
The frr.conf template cannot filter `redistribute connected` except for k8s CIDRs, so a puppet run on prodnxsr0020 drops its hand-written default-route filter and leaks the WAN default route into OSPF.

- add `frrouting::ospf_connected_exclude` to render a REDIST-BLOCK prefix-list and CONNECTED-EXCLUDE-REDIST route-map on `redistribute connected`
- fail when combined with `ospf_exclude_k8s_enable`
- exclude `0.0.0.0/0` on prodnxsr0020

Reviewed-on: #575
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-15 18:40:49 +11:00
unkin-agent badfb70a4b Migrate router to puppet-on-k8s (#574)
Agents move from the VM puppetmasters to puppet-on-k8s one role at a time. prodnxsr0020 is the only router, so the role is enabled as a whole.

- enable profiles::puppet::migrate for roles::infra::network::router

Reviewed-on: #574
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-15 18:35:37 +11:00
unkin-agent efe15ec078 Add networkctl fact (#573)
Hosts running systemd-networkd expose link, address, route and DNS state only through `networkctl`, so none of it is visible in PuppetDB for querying or reporting.

- add `networkctl` fact from `networkctl --json=short`, keyed by interface name
- confine to Linux hosts with `networkctl` and a running networkd (`/run/systemd/netif`)
- return nil on missing output or parse failure so puppet runs never break

Reviewed-on: #573
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-15 18:35:20 +11:00
unkin-agent 452acfacd9 Migrate cobbler to puppet-on-k8s (#568)
Agents move from the VM puppetmasters to puppet-on-k8s one role at a time. The cobbler server has no exported-resource or PuppetDB query coupling to roles still on the VM masters, so it can move on its own.

- enable profiles::puppet::migrate for roles::infra::cobbler::server

Reviewed-on: #568
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-09 23:12:27 +11:00
unkin-agent a5ed2c278e Migrate glauth nodes to puppet-on-k8s (#566)
Glauth nodes have no exported-resource or PuppetDB query coupling to roles still on the VM puppetmasters, so they can move to puppet-on-k8s on their own.

- enable profiles::puppet::migrate for roles::infra::auth::glauth

Reviewed-on: #566
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-09 23:04:40 +11:00
unkin-agent aa125b5e83 Migrate ceph rgw nodes to puppet-on-k8s (#571)
Ceph RGW nodes still run against the VM puppetmasters. The role has no exported-resource or PuppetDB query coupling to roles left on the VM masters, so it moves to puppet-on-k8s on its own.

- enable profiles::puppet::migrate for roles::infra::ceph::rgw

Reviewed-on: #571
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-09 23:01:51 +11:00
unkin-agent a250d30d7d Remove legacy /etc/encapic config (#572)
encapic v0.5.0 drops the RPM-owned /etc/encapic/encapic.conf and the binary fallback to it; config lives in /etc/encapi. Upgraded masters can be left with an empty /etc/encapic or a .rpmsave.

- profiles::puppet::encapic removes /etc/encapic recursively after Package[encapic]
- puppet masters pin encapic 0.5.0

Requires encapic v0.5.0 released.

Reviewed-on: #572
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-09 22:31:39 +11:00
unkin-agent e90884507b Migrate jumphosts to puppet-on-k8s (#565)
Jumphosts still compile against the VM puppetmasters. The role has no exported-resource or PuppetDB query coupling to roles left on the VM masters, so it moves on its own.

- enable profiles::puppet::migrate for roles::infra::proxy::jumphost

Reviewed-on: #565
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-08 22:17:13 +11:00
unkin-agent 49c14e7bda Migrate dhcp servers to puppet-on-k8s (#567)
The dhcp server role has no exported-resource or PuppetDB query coupling to roles still on the VM puppetmasters, so it can move to puppet-on-k8s on its own.

- enable profiles::puppet::migrate for roles::infra::dhcp::server

Reviewed-on: #567
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-08 22:16:52 +11:00
unkin-agent 3726210d38 Move encapic config to /etc/encapi (#569)
encapic 0.4.0 reads /etc/encapi/encapic.conf ahead of the legacy RPM-owned /etc/encapic/encapic.conf, so puppet-managed config no longer collides with the packaged %config(noreplace) file.

- default profiles::puppet::encapic config_dir to /etc/encapi
- bump the encapic pin on puppet masters to 0.4.0

Reviewed-on: #569
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-08 22:16:31 +11:00
unkin-agent 8e2497d612 Migrate git redis nodes to puppet-on-k8s (#564)
The git redis nodes build their redisha peer list from a puppetdb_query of their own role, so all members must move to puppet-on-k8s together.

- enable profiles::puppet::migrate for roles::infra::git::redis

Reviewed-on: #564
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-08 18:59:04 +11:00
unkin-agent 7605623aa8 Migrate consul servers to puppet-on-k8s (#563)
Consul servers build their peer list from a region-scoped PuppetDB query of their own role, so all members must report to the same PuppetDB and move to puppet-on-k8s together. syd1 clients use a static server list and are unaffected.

- enable profiles::puppet::migrate for roles::infra::storage::consul

Reviewed-on: #563
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-08 18:00:40 +11:00
unkin-agent 1961a049f3 Migrate vault nodes to puppet-on-k8s (#562)
Vault nodes build their peer list from a region-scoped PuppetDB query of their own role, so all members must move to puppet-on-k8s together.

- enable profiles::puppet::migrate for roles::infra::storage::vault

Reviewed-on: #562
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-11-08 17:34:28 +11:00
unkin-agent faf96a1dca Run detached noop agent after k8s migration repoint (#561)
Migrated nodes have no facts or exported resources in the k8s PuppetDB until their next agent run (up to splay + runinterval), which breaks exported-resource discovery for services migrated as a group. A noop run registers both at compile time.

- add a refreshonly exec in profiles::puppet::migrate, subscribed to puppet.conf, that launches a detached noop agent run via systemd-run
- skip the exec while a previous puppet-migrate-noop unit is still active

Reviewed-on: #561
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-25 12:39:01 +11:00
unkin-agent e6a06f4845 Add dnsmasq resolver and edge base-class changes to the mail gateway (#554)
The edge gateways sit in BinaryLane VPCs with no consul datacentre and a public interface, and postfix and rspamd need a caching resolver that reaches the lab over the VPN route.

- run dnsmasq as the local resolver, forwarding to 198.18.200.7, and point resolv.conf at it
- add an enable toggle to profiles::consul::client, off for the gateway role
- disable node_exporter on the gateway role, as it registers via consul
- restrict sshd AllowUsers to the edge VPCs (172.18.30.0/24, 172.18.31.0/24, 172.18.32.0/24) and the lab (198.18.0.0/16, 10.10.12.200/32)

Reviewed-on: #554
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-16 23:17:56 +11:00
unkin-agent a14cdbb55a Add the bne dmz vpc and move the mta2 edge to bne (#559)
BinaryLane mel has no stock, so the second mail edge site moves to Brisbane (VPC 172.18.32.0/24); syd and mel stay.

- add 172.18.32.0/24 as region bne1 dmz in subnet facts
- rename the mta2 edge node hiera to aubne1nxvm2132

Reviewed-on: #559
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-16 23:08:56 +11:00
unkin-agent b338c8420a Move mail DMZ VPC subnet facts to RFC 1918 ranges (#558)
BinaryLane only accepts RFC 1918 VPC ranges, so the syd and mel mail DMZ VPCs move from 198.18.30.0/24 and 198.18.31.0/24 to 172.18.30.0/24 and 172.18.31.0/24.

- map 172.18.30.0/24 to syd2 dmz and 172.18.31.0/24 to mel1 dmz, replacing the 198.18.30-31 entries

Reviewed-on: #558
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-16 21:53:13 +11:00
unkin-agent b1f2fff045 Resolve subnet facts from secondary interfaces (#557)
BinaryLane edge hosts have a public primary IP, so region/environment/country/zone resolve to unknown even though their VPC NIC sits in a known subnet.

- match the primary IP first, unchanged for existing hosts
- otherwise scan interface bindings in name order, skipping lo, dum* and wg*
- add modules/libs/test/subnet_facts_check.rb (`ruby modules/libs/test/subnet_facts_check.rb`)

Reviewed-on: #557
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-13 21:46:53 +11:00
unkin-agent 4313b7db49 Fix edge postfix gateway config for unkin.net (#552)
The mail gateway config was copied from an eFa appliance and predates the edge design: unfiltered/dead DNSBLs, a MailScanner milter, no local filtering, and no edge identity.

- filter postscreen DNSBL codes, add mailspike/psbl, drop sorbs/swl; dnswl clients skip greet tests
- run local rspamd (deterministic checks, redis bayes, edge.cf rules fetched each puppet run) as a tempfail milter
- set a 50MB size limit; drop qmqpd, 3DES and eFa leftovers
- relay unkin.net and main.unkin.net to [mail-in.main.unkin.net]:25 with verified TLS and recipient probing
- set myhostname and vault cert SANs per node (mta1/mta2.edge.unkin.net)

Reviewed-on: #552
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-13 21:42:38 +11:00
unkin-agent 693452b4f8 Map the binarylane DMZ VPCs in subnet facts (#556)
The BinaryLane mail edge DMZ VPCs need environment, region, country and zone facts like every other lab subnet.

- map 198.18.30.0/24 to prod/syd2/au/dmz (binarylane syd dmz vpc)
- map 198.18.31.0/24 to prod/mel1/au/dmz (binarylane mel dmz vpc)

Reviewed-on: #556
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-13 21:37:57 +11:00
unkin-agent 6c880d9794 Add consul server federation SANs to consul server certs (#547)
WAN federation through mesh gateways makes Consul verify server certs against `server.<dc>.consul` and `<node_name>.server.<dc>.consul`. Node names are FQDNs, so each server needs its exact SAN. This adds the SANs ahead of Consul server TLS, which a stacked follow-up enables once the reissued certs are verified.

- add `server.<country>-<region>.consul` to consul server alt_names
- add `<fqdn>.server.<country>-<region>.consul` to consul server alt_names

Reviewed-on: #547
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-09 21:51:43 +11:00
unkin-agent 2e95cd00d7 Migrate k8s roles to puppet-on-k8s (#545)
Move the k8s roles to the puppet-on-k8s compilers. Their role code (rke2, frrouting, ceph) has no exported resources or PuppetDB queries; the base consul lookup is covered by the static syd1 server list.

- enable profiles::puppet::migrate in the shared roles::infra::k8s hieradata (compute, control, node)

Reviewed-on: #545
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-05 22:10:50 +11:00
unkin-agent 171cf23a93 Migrate incus nodes to puppet-on-k8s (#546)
Incus nodes still run against the VM puppetservers; move them to the k8s compilers as part of the puppet-on-k8s migration.

- enable profiles::puppet::migrate for roles::infra::incus::node

Reviewed-on: #546
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-05 22:03:30 +11:00
unkin-agent 83cb039b97 consul: use static server list for clients (#544)
Hosts compiled on the k8s puppetservers can't see the consul servers in PuppetDB, so the members lookup returns nothing and syd1 clients get no retry_join targets.

- set a static consul server list for syd1 and disable the members lookup there
- keep the PuppetDB members lookup for all other regions

Reviewed-on: #544
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-05 21:33:03 +11:00
unkin-agent fc26d3cc4a nzbget: fix params lookup copied from sonarr (#543)
nzbget defaulted bind_address and port from sonarr::params, which is not loaded on nzbget-only nodes, so catalog compilation failed with "Unknown variable".

- default bind_address/port from nzbget::params

Reviewed-on: #543
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-05 13:36:52 +11:00
unkin-agent 5fe9f7a9da Migrate media roles to puppet-on-k8s (#540)
The ausyd1nxvm2120 canary is healthy on the puppet-on-k8s servers, so move the next role wave across: the media nodes (ausyd1nxvm2045-2051: nzbget, sonarr, radarr, lidarr, readarr, prowlarr, jellyfin).

- enable `profiles::puppet::migrate` in `roles/apps/media.yaml`

Reviewed-on: #540
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
2026-10-05 12:10:31 +11:00
57 changed files with 619 additions and 861 deletions
+8
View File
@@ -404,6 +404,14 @@ networking::route_defaults:
# logging:
victorialogs::client::journald::enable: true
victorialogs::client::journald::inserturl: https://logs-ingest.k8s.syd1.au.unkin.net:443/insert/journald
nginx::log_format:
journald: '$host $remote_addr - $remote_user "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" rt=$request_time ua="$upstream_addr" us="$upstream_status" urt="$upstream_response_time"'
nginx::http_access_log:
- /var/log/nginx/access.log
- 'syslog:server=unix:/dev/log,tag=nginx_access,nohostname journald'
nginx::nginx_error_log:
- /var/log/nginx/error.log
- 'syslog:server=unix:/dev/log,tag=nginx,nohostname'
# FIXME these are for the proxmox ceph cluster
profiles::ceph::client::fsid: 7f7f00cb-95de-498c-8dcc-14b54e4e9ca8
+8
View File
@@ -7,3 +7,11 @@ profiles_dns_upstream_forwarder_consul:
- 198.18.19.14
profiles_dns_upstream_forwarder_k8s:
- 198.18.19.20
profiles::consul::client::members_lookup: false
# static: k8s-compiled hosts can't see the servers in PuppetDB; update when servers change
profiles::consul::client::consul_servers:
- ausyd1nxvm2005.main.unkin.net
- ausyd1nxvm2006.main.unkin.net
- ausyd1nxvm2007.main.unkin.net
- ausyd1nxvm2008.main.unkin.net
- ausyd1nxvm2009.main.unkin.net
@@ -20,6 +20,7 @@ profiles::haproxy::mappings:
- 'jellyfin.main.unkin.net be_jellyfin'
- 'fafflix.unkin.net be_jellyfin'
- 'git.unkin.net be_gitea'
- 'grafana.unkin.net be_grafana'
- 'dashboard.ceph.unkin.net be_ceph_dashboard'
- 'mail-webadmin.main.unkin.net be_stalwart_webadmin'
- 'autoconfig.main.unkin.net be_stalwart_webadmin'
@@ -39,6 +40,7 @@ profiles::haproxy::mappings:
- 'jellyfin.main.unkin.net be_jellyfin'
- 'fafflix.unkin.net be_jellyfin'
- 'git.unkin.net be_gitea'
- 'grafana.unkin.net be_grafana'
- 'dashboard.ceph.unkin.net be_ceph_dashboard'
- 'mail-webadmin.main.unkin.net be_stalwart_webadmin'
- 'autoconfig.main.unkin.net be_stalwart_webadmin'
@@ -63,6 +65,7 @@ profiles::haproxy::frontends:
- 'acl_jellyfin req.hdr(host) -i jellyfin.main.unkin.net'
- 'acl_fafflix req.hdr(host) -i fafflix.unkin.net'
- 'acl_gitea req.hdr(host) -i git.unkin.net'
- 'acl_grafana req.hdr(host) -i grafana.unkin.net'
- 'acl_ceph_dashboard req.hdr(host) -i dashboard.ceph.unkin.net'
- 'acl_stalwart_webadmin req.hdr(host) -i mail-webadmin.main.unkin.net'
- 'acl_stalwart_webadmin req.hdr(host) -i autoconfig.main.unkin.net'
@@ -84,6 +87,7 @@ profiles::haproxy::frontends:
- 'set-header X-Frame-Options DENY if acl_jellyfin'
- 'set-header X-Frame-Options DENY if acl_fafflix'
- 'set-header X-Frame-Options DENY if acl_gitea'
- 'set-header X-Frame-Options DENY if acl_grafana'
- 'set-header X-Frame-Options DENY if acl_ceph_dashboard'
- 'set-header X-Frame-Options DENY if acl_stalwart_webadmin'
- 'set-header X-Frame-Options DENY if acl_kanidm'
@@ -399,6 +403,7 @@ profiles::haproxy::certlist::certificates:
- /etc/pki/tls/letsencrypt/nzbget.main.unkin.net/fullchain_combined.pem
- /etc/pki/tls/letsencrypt/fafflix.unkin.net/fullchain_combined.pem
- /etc/pki/tls/letsencrypt/git.unkin.net/fullchain_combined.pem
- /etc/pki/tls/letsencrypt/grafana.unkin.net/fullchain_combined.pem
- /etc/pki/tls/letsencrypt/dashboard.ceph.unkin.net/fullchain_combined.pem
- /etc/pki/tls/letsencrypt/auth.unkin.net/fullchain_combined.pem
- /etc/pki/tls/vault/certificate.pem
@@ -426,5 +431,6 @@ certbot::client::domains:
- nzbget.main.unkin.net
- fafflix.unkin.net
- git.unkin.net
- grafana.unkin.net
- dashboard.ceph.unkin.net
- auth.unkin.net
@@ -0,0 +1,4 @@
---
profiles::postfix::gateway::myhostname: 'mta2.edge.unkin.net'
profiles::pki::vault::alt_names:
- mta2.edge.unkin.net
@@ -0,0 +1,4 @@
---
profiles::postfix::gateway::myhostname: 'mta1.edge.unkin.net'
profiles::pki::vault::alt_names:
- mta1.edge.unkin.net
@@ -11,3 +11,8 @@ networking::interfaces:
mac: a4:bb:6d:a4:e5:c1
"%{hiera('networking_2500_iface')}":
mac: c4:62:37:0d:50:03
# dedicated docker-in-docker runner pool
rke2::config_hash:
node-label:
- "unkin.net/runner-pool=dind"
@@ -11,3 +11,8 @@ networking::interfaces:
mac: a4:bb:6d:a4:56:11
"%{hiera('networking_2500_iface')}":
mac: c4:62:37:0d:50:00
# dedicated docker-in-docker runner pool
rke2::config_hash:
node-label:
- "unkin.net/runner-pool=dind"
@@ -43,3 +43,12 @@ frrouting::ospfd_interfaces:
area: 0.0.0.0
frrouting::ospf_preferred_source_enable: true
frrouting::ospf_preferred_source: "%{hiera('networking_loopback1_ip')}"
frrouting::ospf_connected_exclude:
- 0.0.0.0/0
# ntopng: wan uplink plus lan vlans
profiles::metrics::ntopng::interfaces:
- enp1s0
- enp2s0
- bond0.10
- bond0.201
+38 -1
View File
@@ -4,7 +4,6 @@ profiles::firewall::firewalld::ensure_package: 'absent'
profiles::firewall::firewalld::ensure_service: 'stopped'
profiles::firewall::firewalld::enable_service: false
profiles::puppet::agent::version: '7.37.2'
profiles::puppet::agent::openvox_enable: true
hiera_include:
- profiles::almalinux::base
@@ -104,6 +103,14 @@ profiles::yum::global::repos:
gpgcheck: false
mirrorlist: absent
metadata_expire: '60'
iuclabs-tools:
name: iuclabs-tools
descr: iuclabs-tools repository
target: /etc/yum.repos.d/iuclabs-tools.repo
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/virtual/iuclabs-tools/
gpgcheck: false
mirrorlist: absent
metadata_expire: '60'
# Additional repositories - default to absent, roles can override with ensure: present
# FRRouting repositories
@@ -124,6 +131,24 @@ profiles::yum::global::repos:
gpgcheck: false
mirrorlist: absent
# ntop repositories
ntop:
ensure: absent
name: ntop
descr: ntop repository
target: /etc/yum.repos.d/ntop.repo
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/ntop/%{facts.os.release.major}/%{facts.os.architecture}/
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/ntop/RPM-GPG-KEY-deri
mirrorlist: absent
ntop-noarch:
ensure: absent
name: ntop-noarch
descr: ntop-noarch repository
target: /etc/yum.repos.d/ntop-noarch.repo
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/ntop/%{facts.os.release.major}/noarch/
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/ntop/RPM-GPG-KEY-deri
mirrorlist: absent
# PostgreSQL repositories
postgresql-15:
ensure: absent
@@ -147,6 +172,18 @@ profiles::yum::global::repos:
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/postgresql/common/redhat/rhel-%{facts.os.release.major}-%{facts.os.architecture}
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/postgresql/keys/PGDG-RPM-GPG-KEY-RHEL
# Rspamd repositories
rspamd:
ensure: absent
name: rspamd
descr: rspamd repository
target: /etc/yum.repos.d/rspamd.repo
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/rspamd/rpm-stable/centos-%{facts.os.release.major}/x86_64
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/rspamd/rpm/rspamd.asc
gpgcheck: 1
repo_gpgcheck: 1
mirrorlist: absent
# Ceph repositories
ceph:
ensure: absent
+8 -4
View File
@@ -9,10 +9,6 @@
# Fedora releases inherit it for free.
crypto_policies::policy: 'DEFAULT'
# Puppet agent via OpenVox. RedHat-family builds for Fedora live under
# openvox7/fedora/<major> (see profiles::puppet::agent).
profiles::puppet::agent::openvox_enable: true
lm-sensors::package: lm_sensors
# Fedora-specific base setup (NetworkManager, future workstation/laptop hooks).
@@ -69,3 +65,11 @@ profiles::yum::global::repos:
gpgcheck: false
mirrorlist: absent
metadata_expire: '60'
iuclabs-tools:
name: iuclabs-tools
descr: iuclabs-tools repository
target: /etc/yum.repos.d/iuclabs-tools.repo
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/virtual/iuclabs-tools/
gpgcheck: false
mirrorlist: absent
metadata_expire: '60'
+2
View File
@@ -2,6 +2,8 @@
hiera_include:
- profiles::nginx::simpleproxy
profiles::puppet::migrate::enabled: true
profiles::yum::global::repos:
ceph:
ensure: present
+2
View File
@@ -2,6 +2,8 @@
hiera_include:
- glauth
profiles::puppet::migrate::enabled: true
# additional altnames
profiles::pki::vault::alt_names:
- ldap.main.unkin.net
+2
View File
@@ -3,6 +3,8 @@ hiera_include:
- profiles::ceph::rgw
- profiles::nginx::simpleproxy
profiles::puppet::migrate::enabled: true
profiles::ceph::rgw::enable: true
# FIXME: puppet-python wants to try manage python-dev, which is required by the ceph package
@@ -4,6 +4,8 @@ hiera_include:
- frrouting
- exporters::frr_exporter
profiles::puppet::migrate::enabled: true
profiles::packages::include:
cobbler: {}
cobbler3.2-web: {}
+2
View File
@@ -4,6 +4,8 @@ hiera_include:
- profiles::dhcp::server
- exporters::frr_exporter
profiles::puppet::migrate::enabled: true
# networking
anycast_ip: 198.18.19.18
systemd::manage_networkd: true
+2
View File
@@ -14,6 +14,8 @@ profiles::ssh::sign::principals:
hiera_include:
- redisha
profiles::puppet::migrate::enabled: true
redisha::manage_repo: false
redisha::redisha_members_lookup: true
redisha::redisha_members_role: roles::infra::git::redis
+2
View File
@@ -14,6 +14,8 @@ hiera_include:
- profiles::storage::cephfsvols
- exporters::frr_exporter
profiles::puppet::migrate::enabled: true
# FIXME: puppet-python wants to try manage python-dev, which is required by the ceph package
python::manage_dev_package: false
+2
View File
@@ -8,6 +8,8 @@ hiera_include:
- frrouting
- rke2
profiles::puppet::migrate::enabled: true
# manage rke2
rke2::bootstrap_node: prodnxsr0001.main.unkin.net
rke2::join_url: https://join-k8s.service.consul:9345
+84 -12
View File
@@ -1,25 +1,90 @@
---
hiera_include:
- redis
# additional altnames
profiles::pki::vault::alt_names:
- in-mta.main.unkin.net
# no consul datacentre at the edge, so nothing to register or scrape via consul
profiles::consul::client::enable: false
exporters::node_exporter::enable: false
# ssh only from the edge vpcs (syd, mel, bne) and the lab over the vpn route
ssh::server::options:
AllowUsers: '*@172.18.30.0/24 *@172.18.31.0/24 *@172.18.32.0/24 *@198.18.0.0/16 *@10.10.12.200/32'
# local caching resolver for postfix and rspamd, forwarding to the lab resolver over the vpn route
dnsmasq::no_resolv: true
dnsmasq::cache_size: 10000
dnsmasq::servers:
- 198.18.200.7
profiles::dns::base::nameservers:
- 127.0.0.1
profiles::yum::global::repos:
rspamd:
ensure: present
# local redis for rspamd bayes and history; bayes tokens carry a ttl so volatile-ttl can evict
redis::maxmemory: '128mb'
redis::maxmemory_policy: 'volatile-ttl'
# local rspamd, deterministic checks only; module defaults cover spf/dkim/dmarc/arc/rbl/phishing/mime_types/fuzzy_check
profiles::rspamd::edge::rules:
edge.cf: 'https://git.unkin.net/unkin/rspamd-rules/raw/branch/main/edge.cf'
profiles::rspamd::edge::local_d:
worker-proxy.inc: |
bind_socket = "127.0.0.1:11332";
milter = yes;
timeout = 120s;
count = 1;
upstream "local" {
default = yes;
self_scan = yes;
}
worker-normal.inc: |
enabled = false;
redis.conf: |
servers = "127.0.0.1:6379";
actions.conf: |
reject = 13;
add_header = 6;
rewrite_subject = null;
greylist = null;
greylist.conf: |
enabled = false;
gpt.conf: |
enabled = false;
classifier-bayes.conf: |
backend = "redis";
expire = 8640000;
autolearn {
spam_threshold = 6.0;
ham_threshold = -0.5;
check_balance = true;
}
spamassassin.conf: |
ruleset = "/etc/rspamd/rules/*.cf";
alpha = 0.1;
settings.conf: |
smarthost_outbound {
priority = high;
ip = "103.216.191.185";
want_spam = yes;
}
# base postfix configuration (passed to postfix class)
postfix::relayhost: 'direct'
postfix::myorigin: 'main.unkin.net'
postfix::myorigin: 'unkin.net'
postfix::mydestination: 'blank'
postfix::mynetworks: '127.0.0.0/8 [::1]/128'
postfix::mynetworks: '127.0.0.0/8 [::1]/128 103.216.191.185/32'
postfix::mta: true
postfix::manage_aliases: true
# profile parameters for customization
profiles::postfix::gateway::myhostname: 'in-mta.main.unkin.net'
# postfix map content (templates)
profiles::postfix::gateway::relay_recipients_maps:
'@unkin.net': 'OK'
'@main.unkin.net': 'OK'
profiles::postfix::gateway::relay_domains_maps:
'unkin.net': 'OK'
'main.unkin.net': 'OK'
profiles::postfix::gateway::postscreen_access_maps:
@@ -32,21 +97,28 @@ profiles::postfix::gateway::helo_access_maps:
'unknown': 'REJECT'
'localhost': 'REJECT You are not localhost'
profiles::postfix::gateway::smtp_tls_policy_maps:
'[mail-in.main.unkin.net]:25': 'secure match=hostname'
# postfix transports
postfix::transports:
'unkin.net':
ensure: present
destination: 'relay'
nexthop: '[mail-in.main.unkin.net]:25'
'main.unkin.net':
ensure: present
destination: 'relay'
nexthop: 'mail-in.main.unkin.net:25'
nexthop: '[mail-in.main.unkin.net]:25'
# postfix virtuals
postfix::virtuals:
'root':
ensure: present
destination: 'ben@main.unkin.net'
destination: 'ben@unkin.net'
'postmaster':
ensure: present
destination: 'ben@main.unkin.net'
destination: 'ben@unkin.net'
'abuse':
ensure: present
destination: 'ben@main.unkin.net'
destination: 'ben@unkin.net'
+11
View File
@@ -2,6 +2,9 @@
hiera_include:
- frrouting
- exporters::frr_exporter
- profiles::metrics::ntopng
profiles::puppet::migrate::enabled: true
# routing
sysctl::base::values:
@@ -28,3 +31,11 @@ profiles::consul::client::node_rules:
- resource: service
segment: frr_exporter
disposition: write
# ntopng passive dpi; capture interfaces are per-host
profiles::metrics::ntopng::influx_url: https://vmagent.k8s.syd1.au.unkin.net
profiles::yum::global::repos:
ntop:
ensure: present
ntop-noarch:
ensure: present
+1
View File
@@ -14,5 +14,6 @@ certbot::domains:
- nzbget.main.unkin.net
- fafflix.unkin.net
- git.unkin.net
- grafana.unkin.net
- dashboard.ceph.unkin.net
- auth.unkin.net
@@ -1,3 +1,5 @@
profiles::puppet::migrate::enabled: true
profiles::pki::vault::alt_names:
- jumphost.service.consul
- jumphost.query.consul
+1 -1
View File
@@ -31,7 +31,7 @@ profiles::puppet::enc::repo: https://git.service.au-syd1.consul/unkinben/puppet-
# Deep-merged with the entries in roles/infra/puppet.yaml.
profiles::packages::include:
encapic:
ensure: '0.2.0'
ensure: '0.5.0'
certmanager:
ensure: '0.2.0'
sshsignhost:
-41
View File
@@ -1,41 +0,0 @@
---
hiera_include:
- profiles::reposync::webserver
profiles::ssh::sign::principals:
- packagerepo.service.consul
- packagerepo.query.consul
- "packagerepo.service.%{facts.country}-%{facts.region}.consul"
# additional altnames
profiles::pki::vault::alt_names:
- packagerepo.main.unkin.net
- packagerepo.service.consul
- packagerepo.query.consul
- "packagerepo.service.%{facts.country}-%{facts.region}.consul"
# configure consul service
consul::services:
packagerepo:
service_name: 'packagerepo'
tags:
- 'packagerepo'
address: "%{facts.networking.ip}"
port: 443
checks:
- id: 'packagerepo_http_check'
name: 'packagerepo HTTP Check'
http: "https://%{facts.networking.fqdn}"
method: 'GET'
tls_skip_verify: true
interval: '10s'
timeout: '1s'
profiles::consul::client::node_rules:
- resource: service
segment: packagerepo
disposition: write
profiles::reposync::webserver::nginx_listen_mode: both
profiles::reposync::webserver::nginx_cert_type: vault
profiles::reposync::webserver::www_root: /shared/apps/packagerepo/snap
profiles::reposync::webserver::cache_root: /data/repos/cache
@@ -1,89 +0,0 @@
---
profiles::packages::include:
createrepo: {}
profiles::reposync::repos_list:
docker_stable_el8:
repository: 'stable'
description: 'Docker CE Stable EL8'
osname: 'docker'
release: 'el8'
baseurl: 'https://download.docker.com/linux/centos/8/x86_64/stable/'
gpgkey: 'https://download.docker.com/linux/centos/gpg'
docker_stable_el9:
repository: 'stable'
description: 'Docker CE Stable EL9'
osname: 'docker'
release: 'el9'
baseurl: 'https://download.docker.com/linux/centos/9/x86_64/stable/'
gpgkey: 'https://download.docker.com/linux/centos/gpg'
k8s_1.32:
repository: '1.32'
description: 'Kubernetes 1.32'
osname: 'k8s'
release: '1.32'
baseurl: 'https://pkgs.k8s.io/core:/stable:/v1.32/rpm/'
gpgkey: 'https://pkgs.k8s.io/core:/stable:/v1.32/rpm/repodata/repomd.xml.key'
k8s_1.33:
repository: '1.33'
description: 'Kubernetes 1.33'
osname: 'k8s'
release: '1.33'
baseurl: 'https://pkgs.k8s.io/core:/stable:/v1.33/rpm/'
gpgkey: 'https://pkgs.k8s.io/core:/stable:/v1.33/rpm/repodata/repomd.xml.key'
puppet7_el8:
repository: '8'
description: 'Puppet 7 EL8'
osname: 'puppet7'
release: 'el'
baseurl: 'https://yum.puppet.com/puppet7/el/8/x86_64/'
gpgkey: 'https://yum.puppet.com/RPM-GPG-KEY-puppet-20250406'
puppet7_el9:
repository: '9'
description: 'Puppet 7 EL9'
osname: 'puppet7'
release: 'el'
baseurl: 'https://yum.puppet.com/puppet7/el/9/x86_64/'
gpgkey: 'https://yum.puppet.com/RPM-GPG-KEY-puppet-20250406'
puppet8_el8:
repository: '8'
description: 'Puppet 8 EL8'
osname: 'puppet8'
release: 'el'
baseurl: 'https://yum.puppet.com/puppet8/el/8/x86_64/'
gpgkey: 'https://yum.puppet.com/RPM-GPG-KEY-puppet-20250406'
puppet8_el9:
repository: '9'
description: 'Puppet 8 EL9'
osname: 'puppet8'
release: 'el'
baseurl: 'https://yum.puppet.com/puppet8/el/9/x86_64/'
gpgkey: 'https://yum.puppet.com/RPM-GPG-KEY-puppet-20250406'
zfs_dkms_rhel8:
repository: 'dkms'
description: 'ZFS DKMS RHEL 8'
osname: 'zfs'
release: 'rhel8'
baseurl: 'http://download.zfsonlinux.org/epel/8/x86_64/'
gpgkey: 'https://packagerepo.service.consul/zfs/gpg/RPM-GPG-KEY-openzfs-2013'
zfs_kmod_rhel8:
repository: 'kmod'
description: 'ZFS KMOD RHEL 8'
osname: 'zfs'
release: 'rhel8'
baseurl: 'http://download.zfsonlinux.org/epel/8/kmod/x86_64/'
gpgkey: 'https://packagerepo.service.consul/zfs/gpg/RPM-GPG-KEY-openzfs-2013'
zfs_dkms_rhel9:
repository: 'dkms'
description: 'ZFS DKMS RHEL 9'
osname: 'zfs'
release: 'rhel9'
baseurl: 'http://download.zfsonlinux.org/epel/9/x86_64/'
gpgkey: 'https://packagerepo.service.consul/zfs/gpg/RPM-GPG-KEY-openzfs-2022'
zfs_kmod_rhel9:
repository: 'kmod'
description: 'ZFS KMOD RHEL 9'
osname: 'zfs'
release: 'rhel9'
baseurl: 'http://download.zfsonlinux.org/epel/9/kmod/x86_64/'
gpgkey: 'https://packagerepo.service.consul/zfs/gpg/RPM-GPG-KEY-openzfs-2022'
@@ -3,6 +3,8 @@ hiera_include:
- frrouting
- exporters::frr_exporter
profiles::puppet::migrate::enabled: true
profiles::consul::server::members_lookup: true
profiles::consul::server::data_dir: /data/consul
profiles::consul::server::addresses:
@@ -31,6 +33,8 @@ profiles::pki::vault::alt_names:
- consul.service.consul
- "consul.service.%{facts.country}-%{facts.region}.consul"
- consul
- "server.%{facts.country}-%{facts.region}.consul"
- "%{facts.networking.fqdn}.server.%{facts.country}-%{facts.region}.consul"
# manage a simple nginx reverse proxy
profiles::nginx::simpleproxy::nginx_vhost: 'consul.service.consul'
@@ -40,6 +44,7 @@ profiles::nginx::simpleproxy::nginx_aliases:
profiles::nginx::simpleproxy::proxy_port: 8500
profiles::nginx::simpleproxy::proxy_path: '/'
nginx::client_max_body_size: 512M
nginx::proxy_read_timeout: '360s'
# consul
profiles::consul::client::node_rules:
+2
View File
@@ -1,4 +1,6 @@
---
profiles::puppet::migrate::enabled: true
profiles::vault::server::members_role: roles::infra::storage::vault
profiles::vault::server::members_lookup: true
profiles::vault::server::data_dir: /data/vault
+8 -2
View File
@@ -69,8 +69,14 @@ class certbot::nginx (
'listen_port' => $listen_port,
'server_name' => $server_names,
'use_default_location' => true,
'access_log' => "/var/log/nginx/${nginx_vhost}_access.log",
'error_log' => "/var/log/nginx/${nginx_vhost}_error.log",
'access_log' => [
"/var/log/nginx/${nginx_vhost}_access.log",
'syslog:server=unix:/dev/log,tag=nginx_access,nohostname journald',
],
'error_log' => [
"/var/log/nginx/${nginx_vhost}_error.log",
'syslog:server=unix:/dev/log,tag=nginx,nohostname',
],
'www_root' => "${data_root}/pub",
'autoindex' => 'on',
'ssl' => $enable_ssl,
+5
View File
@@ -19,6 +19,7 @@ class frrouting (
Boolean $ospf_exclude_k8s_enable = false,
Optional[Stdlib::IP::Address::V4::CIDR] $k8s_cluster_cidr = undef, # pod/cluster CIDR (e.g. 10.42.0.0/16)
Optional[Stdlib::IP::Address::V4::CIDR] $k8s_service_cidr = undef, # service CIDR (e.g. 10.43.0.0/16)
Array[Stdlib::IP::Address::V4::CIDR] $ospf_connected_exclude = [], # exact-match prefixes kept out of redistribute connected
) {
# sanity check
@@ -26,6 +27,10 @@ class frrouting (
warning('frrouting: ospf_exclude_k8s_enable is true but no k8s_*_cidr provided; nothing will be filtered.')
}
if $ospf_exclude_k8s_enable and !empty($ospf_connected_exclude) {
fail('frrouting: ospf_exclude_k8s_enable and ospf_connected_exclude are mutually exclusive.')
}
$daemons_defaults = {
'bgpd' => false,
'ospfd' => true,
+14
View File
@@ -27,6 +27,18 @@ exit
route-map CONNECTED-NON-K8S permit 100
exit
<% end -%>
<% if @ospf_connected_exclude.any? -%>
! Do not redistribute default route
<% @ospf_connected_exclude.each_with_index do |prefix, i| -%>
ip prefix-list REDIST-BLOCK seq <%= (i + 1) * 5 %> permit <%= prefix %>
<% end -%>
route-map CONNECTED-EXCLUDE-REDIST deny 5
match ip address prefix-list REDIST-BLOCK
exit
route-map CONNECTED-EXCLUDE-REDIST permit 100
exit
<% end -%>
router ospf
ospf router-id <%= @ospfd_router_id %>
@@ -34,6 +46,8 @@ router ospf
<% @ospfd_redistribute.each do |type| -%>
<% if @ospf_exclude_k8s_enable && type == 'connected' && (@k8s_cluster_cidr || @k8s_service_cidr) -%>
redistribute connected route-map CONNECTED-NON-K8S
<% elsif type == 'connected' && @ospf_connected_exclude.any? -%>
redistribute connected route-map CONNECTED-EXCLUDE-REDIST
<% else -%>
redistribute <%= type %>
<% end -%>
+52
View File
@@ -0,0 +1,52 @@
# frozen_string_literal: true
require 'facter'
require 'ipaddr'
require 'json'
# Exposes systemd-networkd managed link state from `networkctl --json=short`, keyed by interface name.
module NetworkctlFact
module_function
KEYS = %w[Type Kind AdministrativeState OperationalState CarrierState OnlineState MTU
NetworkFile NetworkFileDropins NetDevFile NetDevFileDropins LinkFile].freeze
def address(addr)
return unless [2, 10].include?(addr['Family'])
"#{IPAddr.new_ntoh(addr['Address'].pack('C*'))}/#{addr['PrefixLength']}"
end
def mac(bytes)
bytes&.map { |byte| format('%02x', byte) }&.join(':')
end
def slim(iface)
out = iface.slice(*KEYS).merge('HardwareAddress' => mac(iface['HardwareAddress'])).compact
out.reject! { |_key, val| val == [] }
addrs = Array(iface['Addresses']).filter_map { |addr| address(addr) }
out['Addresses'] = addrs unless addrs.empty?
out
end
def parse(output)
managed = JSON.parse(output).fetch('Interfaces').reject { |iface| iface['AdministrativeState'] == 'unmanaged' }
managed.to_h { |iface| [iface['Name'], slim(iface)] } unless managed.empty?
end
def resolve
output = Facter::Core::Execution.execute('networkctl --json=short 2>/dev/null', on_fail: nil)
return nil if output.to_s.empty?
parse(output)
rescue StandardError
nil
end
end
Facter.add(:networkctl) do
confine kernel: 'Linux'
confine { Facter::Core::Execution.which('networkctl') }
confine { File.directory?('/run/systemd/netif') }
setcode { NetworkctlFact.resolve }
end
+31 -12
View File
@@ -22,27 +22,46 @@ class SubnetAttributes
'198.18.26.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0010
'198.18.27.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0011
'198.18.28.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0012
'198.18.29.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' } # common node0013
'198.18.29.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # common node0013
'172.18.30.0/24' => { environment: 'prod', region: 'syd2', country: 'au', zone: 'dmz' }, # binarylane syd dmz vpc
'172.18.31.0/24' => { environment: 'prod', region: 'mel1', country: 'au', zone: 'dmz' }, # binarylane mel dmz vpc
'172.18.32.0/24' => { environment: 'prod', region: 'bne1', country: 'au', zone: 'dmz' } # binarylane bne dmz vpc
}.freeze
# Default attributes if no subnet matches, also defined as a constant
DEFAULT_ATTRIBUTES = { environment: 'unknown', region: 'unknown', country: 'unknown' }.freeze
# provide ip to return attributes
def self.attributes(ip)
SUBNET_TO_ATTRIBUTES.each do |subnet, attrs|
return attrs if IPAddr.new(subnet).include?(IPAddr.new(ip))
end
# loopbacks and wg /31s sit in syd1 ranges, so they must not decide where a host lives
SKIPPED_INTERFACES = /\A(lo\z|dum|wg)/.freeze
DEFAULT_ATTRIBUTES
# primary ip first, then the remaining interfaces in name order
def self.from_networking(networking)
match(networking['ip']) || interface_match(networking['interfaces'] || {}) || DEFAULT_ATTRIBUTES
end
def self.interface_match(interfaces)
interfaces.sort
.reject { |name, _interface| name.match?(SKIPPED_INTERFACES) }
.flat_map { |_name, interface| addresses(interface) }
.lazy.filter_map { |address| match(address) }.first
end
def self.addresses(interface)
(interface['bindings'] || []).map { |binding| binding['address'] }
end
def self.match(ip)
return unless ip
addr = IPAddr.new(ip)
SUBNET_TO_ATTRIBUTES.each do |subnet, attrs|
return attrs if IPAddr.new(subnet).include?(addr)
end
nil
end
end
# Use the primary IP address from facts
ip = Facter.value(:networking)['ip']
# Call the class method directly without creating an instance
subnet_attributes = SubnetAttributes.attributes(ip)
subnet_attributes = SubnetAttributes.from_networking(Facter.value(:networking))
# Add separate facts for environment, region, and country
Facter.add('environment') { setcode { subnet_attributes[:environment] } }
+36
View File
@@ -0,0 +1,36 @@
# frozen_string_literal: true
# ruby modules/libs/test/subnet_facts_check.rb
module Facter
def self.value(_name)
{}
end
def self.add(*); end
end
load File.expand_path('../lib/facter/subnet_facts.rb', __dir__)
iface = ->(*addresses) { { 'bindings' => addresses.map { |address| { 'address' => address } } } }
checks = {
'primary ip wins over other interfaces' => [
{ 'ip' => '198.18.17.5', 'interfaces' => { 'eth1' => iface.call('198.18.13.5') } }, 'drw1'
],
'unmatched primary ip falls back to an interface' => [
{ 'ip' => '203.0.113.5', 'interfaces' => { 'eth0' => iface.call('203.0.113.5'), 'eth1' => iface.call('198.18.24.11') } }, 'syd1'
],
'lo, dum and wg interfaces are skipped' => [
{ 'ip' => '203.0.113.5',
'interfaces' => { 'dum0' => iface.call('198.18.2.161'), 'lo' => iface.call('198.18.19.1'),
'wg0' => iface.call('198.18.2.177') } }, 'unknown'
],
'interfaces are scanned in name order' => [
{ 'ip' => '203.0.113.5', 'interfaces' => { 'eth2' => iface.call('198.18.24.1'), 'eth1' => iface.call('198.18.17.1') } }, 'drw1'
],
'missing ip and interfaces resolve to unknown' => [{}, 'unknown']
}
failures = checks.reject { |_name, (networking, expected)| SubnetAttributes.from_networking(networking)[:region] == expected }
failures.each_key { |name| warn "FAIL: #{name}" }
abort if failures.any?
puts "ok (#{checks.size} checks)"
+2 -2
View File
@@ -6,8 +6,8 @@ class nzbget (
$manage_group = $nzbget::params::manage_group,
$service_enable = $nzbget::params::service_enable,
$service_name = $nzbget::params::service_name,
$bind_address = $sonarr::params::bind_address,
$port = $sonarr::params::port,
$bind_address = $nzbget::params::bind_address,
$port = $nzbget::params::port,
) inherits nzbget::params {
include nzbget::install
@@ -26,16 +26,47 @@ class victorialogs::client::journald (
content => template('victorialogs/client.journald.conf.erb')
}
if $facts['os']['selinux']['config_mode'] == 'enforcing' {
$journal_upload_te = @("EOF")
module journal_upload_local 1.0;
require {
type systemd_journal_upload_t;
type http_port_t;
class tcp_socket name_connect;
}
allow systemd_journal_upload_t http_port_t:tcp_socket name_connect;
| EOF
selinux::module { 'journal_upload_local':
ensure => 'present',
content_te => $journal_upload_te,
builder => 'simple',
before => Service['systemd-journal-upload'],
}
}
service {'systemd-journal-upload':
ensure => true,
enable => true,
subscribe => File['/etc/systemd/journal-upload.conf.d/victorialogs.conf'],
}
# EL drops the audit socket from journald's Sockets=; journald only takes listen fds at start
systemd::dropin_file { 'audit.conf':
unit => 'systemd-journald.service',
content => "[Service]\nSockets=systemd-journald-audit.socket\n",
}
}else{
file {'/etc/systemd/journal-upload.conf.d/victorialogs.conf':
ensure => absent,
}
systemd::dropin_file { 'audit.conf':
ensure => absent,
unit => 'systemd-journald.service',
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

+5
View File
@@ -12,8 +12,13 @@ class profiles::consul::client (
Array[Hash] $node_rules = [],
Hash $ports = {},
Stdlib::IP::Address $host_addr = $facts['networking']['ip'],
Boolean $enable = true,
) {
unless $enable {
return()
}
if $facts['enc_role'] != $members_role {
# set a datacentre/cluster name
+8 -2
View File
@@ -79,8 +79,14 @@ class profiles::edgecache::nginx {
'listen_port' => $listen_port,
'server_name' => $server_names,
'use_default_location' => true,
'access_log' => "/var/log/nginx/${nginx_vhost}_access.log",
'error_log' => "/var/log/nginx/${nginx_vhost}_error.log",
'access_log' => [
"/var/log/nginx/${nginx_vhost}_access.log",
'syslog:server=unix:/dev/log,tag=nginx_access,nohostname journald',
],
'error_log' => [
"/var/log/nginx/${nginx_vhost}_error.log",
'syslog:server=unix:/dev/log,tag=nginx,nohostname',
],
'www_root' => "${data_root}/pub",
'autoindex' => 'on',
'ssl' => $enable_ssl,
+62
View File
@@ -0,0 +1,62 @@
# passive ntopng community dpi on the given interfaces, local redis, web ui on localhost only
# - influx_url: influxdb-compatible write base url (ntopng appends /write?db=...); unset keeps the local rrd driver
# timeseries are interface-level ndpi protocol + category only; per-host series stay off for cardinality
class profiles::metrics::ntopng (
Array[String[1], 1] $interfaces,
Optional[Stdlib::HTTPUrl] $influx_url = undef,
String[1] $influx_dbname = 'ntopng',
String[1] $http_listen = '127.0.0.1:3000',
) {
include redis
package { 'ntopng':
ensure => installed,
}
$conf = ($interfaces.map |$i| { "-i=${i}" } + [
'-r=127.0.0.1:6379',
"-w=${http_listen}",
'-W=0',
]).join("\n")
file { '/etc/ntopng/ntopng.conf':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => "${conf}\n",
require => Package['ntopng'],
notify => Service['ntopng'],
}
# timeseries settings are runtime prefs held in redis, not config-file options
$ts_prefs = {
'hosts_ts_creation' => 'off',
'host_ndpi_timeseries_creation' => 'none',
'interface_ndpi_timeseries_creation' => 'both',
}
$influx_prefs = $influx_url ? {
undef => {},
default => {
'timeseries_driver' => 'influxdb',
'ts_post_data_url' => $influx_url,
'influx_dbname' => $influx_dbname,
},
}
($ts_prefs + $influx_prefs).each |$key, $value| {
exec { "ntopng_pref_${key}":
provider => shell,
command => "/usr/bin/redis-cli set ntopng.prefs.${key} '${value}'",
unless => "/usr/bin/test \"$(/usr/bin/redis-cli get ntopng.prefs.${key})\" = '${value}'",
require => Class['redis'],
notify => Service['ntopng'],
}
}
service { 'ntopng':
ensure => running,
enable => true,
require => [Package['ntopng'], Class['redis']],
}
}
+8 -2
View File
@@ -86,8 +86,14 @@ class profiles::nginx::simpleproxy (
'listen_port' => $listen_port,
'server_name' => $server_names,
'use_default_location' => $use_default_location,
'access_log' => "/var/log/nginx/${nginx_vhost}_access.log",
'error_log' => "/var/log/nginx/${nginx_vhost}_error.log",
'access_log' => [
"/var/log/nginx/${nginx_vhost}_access.log",
'syslog:server=unix:/dev/log,tag=nginx_access,nohostname journald',
],
'error_log' => [
"/var/log/nginx/${nginx_vhost}_error.log",
'syslog:server=unix:/dev/log,tag=nginx,nohostname',
],
'autoindex' => 'on',
'ssl' => $enable_ssl,
'ssl_cert' => $ssl_cert,
+30 -24
View File
@@ -3,8 +3,7 @@ class profiles::postfix::gateway (
Stdlib::Absolutepath $tls_key_file = '/etc/pki/tls/vault/certificate.pem',
Stdlib::Absolutepath $tls_ca_file = '/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem',
String $myhostname = $trusted['certname'],
String $message_size_limit = '133169152',
String $mailbox_size_limit = '133169152',
String $message_size_limit = '52428800',
String $local_transport = 'error:No local mail delivery',
Boolean $enable_postscreen = true,
Array[String] $alias_maps = [
@@ -12,12 +11,12 @@ class profiles::postfix::gateway (
'hash:/etc/postfix/aliases',
],
Array[String] $postscreen_dnsbl_sites = [
'zen.spamhaus.org*3',
'b.barracudacentral.org=127.0.0.[2..11]*2',
'bl.spameatingmonkey.net*2',
'bl.spamcop.net',
'dnsbl.sorbs.net',
'swl.spamhaus.org*-4',
'zen.spamhaus.org=127.0.0.[2..11]*3',
'b.barracudacentral.org=127.0.0.2*2',
'bl.mailspike.net=127.0.0.2*1',
'psbl.surriel.com=127.0.0.2*1',
'bl.spameatingmonkey.net=127.0.0.2*2',
'bl.spamcop.net=127.0.0.2',
'list.dnswl.org=127.[0..255].[0..255].0*-2',
'list.dnswl.org=127.[0..255].[0..255].1*-4',
'list.dnswl.org=127.[0..255].[0..255].[2..3]*-6',
@@ -25,7 +24,6 @@ class profiles::postfix::gateway (
Array[String] $smtpd_client_restrictions = [
'permit_sasl_authenticated',
'permit_mynetworks',
'reject_rbl_client zen.spamhaus.org',
],
Array[String] $smtpd_sender_restrictions = [
'permit_sasl_authenticated',
@@ -47,6 +45,7 @@ class profiles::postfix::gateway (
'permit_mynetworks',
'reject_unauth_destination',
],
String $smtpd_milters = 'inet:127.0.0.1:11332',
Hash[String, String] $smtp_tls_policy_maps = {},
Hash[String, String] $sender_canonical_maps = {},
Hash[String, String] $sender_access_maps = {},
@@ -73,7 +72,7 @@ class profiles::postfix::gateway (
'value' => 'permit_mynetworks, cidr:/etc/postfix/postscreen_access'
},
'postscreen_blacklist_action' => {
'value' => 'enforce'
'value' => 'drop'
},
'postscreen_cache_map' => {
'value' => 'btree:$data_directory/postscreen_cache'
@@ -87,6 +86,10 @@ class profiles::postfix::gateway (
'postscreen_dnsbl_threshold' => {
'value' => '2'
},
# dnswl-listed clients (net score <= -1) skip the slow greet tests; el9 postfix 3.5 predates the allowlist rename
'postscreen_dnsbl_whitelist_threshold' => {
'value' => '-1'
},
'postscreen_greet_action' => {
'value' => 'enforce'
},
@@ -108,9 +111,6 @@ class profiles::postfix::gateway (
'alias_database' => {
'value' => $alias_maps_string
},
'default_destination_recipient_limit' => {
'value' => '1'
},
'disable_vrfy_command' => {
'value' => 'yes'
},
@@ -129,9 +129,6 @@ class profiles::postfix::gateway (
'local_transport' => {
'value' => $local_transport
},
'mailbox_size_limit' => {
'value' => $mailbox_size_limit
},
'message_size_limit' => {
'value' => $message_size_limit
},
@@ -141,8 +138,20 @@ class profiles::postfix::gateway (
'non_smtpd_milters' => {
'ensure' => 'blank'
},
'qmqpd_authorized_clients' => {
'value' => '127.0.0.1 [::1]'
'milter_connect_timeout' => {
'value' => '10s'
},
'milter_content_timeout' => {
'value' => '60s'
},
'milter_default_action' => {
'value' => 'tempfail'
},
'milter_mail_macros' => {
'value' => 'i {mail_addr} {client_addr} {client_name} {auth_authen}'
},
'milter_protocol' => {
'value' => '6'
},
'recipient_canonical_maps' => {
'value' => 'hash:/etc/postfix/recipient_canonical'
@@ -177,7 +186,7 @@ class profiles::postfix::gateway (
'smtp_tls_session_cache_database' => {
'value' => 'btree:/var/lib/postfix/smtp_tls_session_cache'
},
'smtp_use_tls' => {
'smtp_send_xforward_command' => {
'value' => 'yes'
},
'smtpd_banner' => {
@@ -211,7 +220,7 @@ class profiles::postfix::gateway (
'value' => 'check_helo_access hash:/etc/postfix/helo_access, reject_invalid_hostname'
},
'smtpd_milters' => {
'value' => 'inet:127.0.0.1:33333'
'value' => $smtpd_milters
},
'smtpd_recipient_restrictions' => {
'value' => join($smtpd_recipient_restrictions, ', ')
@@ -255,13 +264,10 @@ class profiles::postfix::gateway (
'smtpd_tls_session_cache_timeout' => {
'value' => '3600s'
},
'smtpd_use_tls' => {
'value' => 'yes'
},
'tls_medium_cipherlist' => {
'value' => join([
'ECDSA+AESGCM:ECDH+AESGCM:DH+AESGCM:ECDSA+AES:ECDH+AES:DH+AES',
'ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS'
'RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS:!3DES'
], ':')
},
'tls_preempt_cipherlist' => {
+8 -22
View File
@@ -1,20 +1,15 @@
# profiles::puppet::agent
# This class manages Puppet agent package and service.
class profiles::puppet::agent (
String $version = 'latest',
Boolean $openvox_enable = false,
String $version = 'latest',
) {
# set openvox package, yumrepo, service
if $openvox_enable {
$use_package = 'openvox-agent'
$use_yumrepo = 'openvox'
$use_service = 'puppet'
}else{
$use_package = 'puppet-agent'
$use_yumrepo = 'puppet'
$use_service = 'puppet'
# RedHat-family installs OpenVox from artifactapi; Debian installs puppet-agent via apt
$use_package = $facts['os']['family'] ? {
'RedHat' => 'openvox-agent',
default => 'puppet-agent',
}
$use_service = 'puppet'
# OpenVox publishes RedHat-family builds per distribution: enterprise-linux
# under el/<major>, Fedora under fedora/<major>.
@@ -23,8 +18,7 @@ class profiles::puppet::agent (
default => 'el',
}
# manage the yumrepo for the given package
if $openvox_enable and $facts['os']['family'] == 'RedHat' {
if $facts['os']['family'] == 'RedHat' {
yumrepo { 'openvox':
ensure => 'present',
baseurl => "https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/openvox/openvox7/${openvox_dist}/${facts['os']['release']['major']}/${facts['os']['architecture']}/",
@@ -32,14 +26,6 @@ class profiles::puppet::agent (
gpgkey => 'https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/openvox/GPG-KEY-openvox.pub',
notify => Exec['dnf_makecache'],
}
}else{
yumrepo { 'puppet':
ensure => 'present',
baseurl => "https://packagerepo.service.consul/puppet7/el/${facts['os']['release']['major']}-daily/${facts['os']['architecture']}/os/",
descr => 'puppet repository',
gpgkey => "https://packagerepo.service.consul/puppet7/el/${facts['os']['release']['major']}-daily/${facts['os']['architecture']}/os/RPM-GPG-KEY-puppet-20250406",
notify => Exec['dnf_makecache'],
}
}
# if agent-version is anything other than latest, set a versionlock
@@ -57,7 +43,7 @@ class profiles::puppet::agent (
# Ensure the agent package is installed and locked to a specific version
package { $use_package:
ensure => $version,
require => Yumrepo[$use_yumrepo],
require => Yumrepo['openvox'],
}
# versionlock puppet-agent before install so the lock exists before any upgrade is attempted
+9 -3
View File
@@ -5,14 +5,13 @@
# config so the encapi endpoint can change without repackaging.
class profiles::puppet::encapic (
Stdlib::HTTPUrl $encapi_url,
Stdlib::AbsolutePath $config_dir = '/etc/encapic',
Stdlib::AbsolutePath $config_dir = '/etc/encapi',
String $config_name = 'encapic.conf',
String $owner = 'root',
String $group = 'root',
) {
# The RPM ships this file as %config(noreplace), so puppet must write it only
# once the package is present or the install overwrites it.
# order after the package so the shim exists before the config does.
file { $config_dir:
ensure => directory,
mode => '0755',
@@ -29,4 +28,11 @@ class profiles::puppet::encapic (
content => "ENCAPI_URL=${encapi_url}\n",
require => File[$config_dir],
}
# legacy pre-0.5.0 config dir; also clears any rpm .rpmsave left behind
file { '/etc/encapic':
ensure => absent,
force => true,
require => Package['encapic'],
}
}
+12
View File
@@ -17,6 +17,8 @@
# still points at it when it applies this change). profiles::puppet::client
# rewrites puppet.conf with the new server / ca_server / report_server / ssldir
# and notifies Service['puppet'], so the very next agent run lands on k8s.
# The puppet.conf change also fires a detached noop run so facts and exported
# resources register in the k8s PuppetDB immediately.
#
# NOTE: this is deliberately hiera-driven per node/role so waves can be rolled
# out and rolled back one target at a time. The class only manages the fresh
@@ -83,5 +85,15 @@ class profiles::puppet::migrate (
group => 'root',
mode => '0771',
}
exec { 'puppet-migrate-noop-run':
command => join([
'/usr/bin/systemd-run --unit=puppet-migrate-noop --collect',
'/opt/puppetlabs/bin/puppet agent --onetime --no-daemonize --noop --no-splay --waitforlock 10 --maxwaitforlock 900',
], ' '),
unless => '/usr/bin/systemctl is-active --quiet puppet-migrate-noop',
refreshonly => true,
subscribe => File['/etc/puppetlabs/puppet/puppet.conf'],
}
}
}
@@ -115,6 +115,14 @@ class profiles::puppet::puppetboard (
proxy_redirect => 'off',
proxy_connect_timeout => '10s',
proxy_read_timeout => '10s',
access_log => [
"/var/log/nginx/${nginx_vhost}.access.log",
'syslog:server=unix:/dev/log,tag=nginx_access,nohostname journald',
],
error_log => [
"/var/log/nginx/${nginx_vhost}.error.log",
'syslog:server=unix:/dev/log,tag=nginx,nohostname',
],
}
# service static files from nginx for performance
@@ -1,105 +0,0 @@
# setup the autopromoter
class profiles::reposync::autopromoter {
# Ensure the autopromoter script is present and executable
file { '/usr/local/bin/autopromoter':
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0755',
content => template('profiles/reposync/autopromoter.erb'),
}
# daily autopromote service/timer
$_daily_timer = @(EOT)
[Unit]
Description=autopromoter daily timer
[Timer]
OnCalendar=*-*-* 05:00:00
RandomizedDelaySec=1s
[Install]
WantedBy=timers.target
EOT
$_daily_service = @(EOT)
[Unit]
Description=autopromoter daily service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/autopromoter daily
User=root
Group=root
PermissionsStartOnly=false
PrivateTmp=no
EOT
systemd::timer { 'autopromoter-daily.timer':
timer_content => $_daily_timer,
service_content => $_daily_service,
active => true,
enable => true,
require => File['/usr/local/bin/autopromoter'],
}
# weekly autopromote service/timer
$_weekly_timer = @(EOT)
[Unit]
Description=autopromoter weekly timer
[Timer]
OnCalendar=Sun *-*-* 05:05:00
RandomizedDelaySec=1s
[Install]
WantedBy=timers.target
EOT
$_weekly_service = @(EOT)
[Unit]
Description=autopromoter weekly service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/autopromoter weekly
User=root
Group=root
PermissionsStartOnly=false
PrivateTmp=no
EOT
systemd::timer { 'autopromoter-weekly.timer':
timer_content => $_weekly_timer,
service_content => $_weekly_service,
active => true,
enable => true,
require => File['/usr/local/bin/autopromoter'],
}
# monthly autopromote service/timer
$_monthly_timer = @(EOT)
[Unit]
Description=autopromoter monthly timer
[Timer]
OnCalendar=*-*-01 05:10:00
RandomizedDelaySec=1s
[Install]
WantedBy=timers.target
EOT
$_monthly_service = @(EOT)
[Unit]
Description=autopromoter monthly service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/autopromoter monthly
User=root
Group=root
PermissionsStartOnly=false
PrivateTmp=no
EOT
systemd::timer { 'autopromoter-monthly.timer':
timer_content => $_monthly_timer,
service_content => $_monthly_service,
active => true,
enable => true,
require => File['/usr/local/bin/autopromoter'],
}
}
@@ -1,46 +0,0 @@
# setup the autosyncer
class profiles::reposync::autosyncer (
Stdlib::Absolutepath $basepath = '/shared/apps/packagerepo',
) {
# Ensure the autosyncer script is present and executable
file { '/usr/local/bin/autosyncer':
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0755',
content => template('profiles/reposync/autosyncer.erb'),
require => Package['createrepo'],
}
# daily autosyncr service/timer
$_timer = @(EOT)
[Unit]
Description=autosyncer timer
[Timer]
OnCalendar=*-*-* 03:00:00
RandomizedDelaySec=1s
[Install]
WantedBy=timers.target
EOT
$_service = @(EOT)
[Unit]
Description=autosyncer service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/autosyncer
User=root
Group=root
PermissionsStartOnly=false
PrivateTmp=no
EOT
systemd::timer { 'autosyncer.timer':
timer_content => $_timer,
service_content => $_service,
active => true,
enable => true,
require => File['/usr/local/bin/autosyncer'],
}
}
-52
View File
@@ -1,52 +0,0 @@
# define to generate repositories in yum
define profiles::reposync::repos (
String $repository,
String $description,
String $osname,
String $release,
Stdlib::Filesource $gpgkey,
String $arch = 'x86_64',
String $repo_owner = 'root',
String $repo_group = 'root',
Stdlib::Absolutepath $basepath = '/shared/apps/packagerepo',
Optional[Stdlib::HTTPUrl] $baseurl = undef,
Optional[Stdlib::HTTPUrl] $mirrorlist = undef,
){
if ($mirrorlist == undef and $baseurl == undef) or ($mirrorlist != undef and $baseurl != undef) {
fail('profiles::reposync::repos must have either mirrorlist or baseurl set, but not both')
}
$repos_name = downcase("${osname}-${release}-${repository}-${arch}")
$conf_file = "/etc/reposync/conf.d/${repos_name}.conf"
# Create the repository configuration
yumrepo { $repos_name:
ensure => 'present',
descr => $description,
baseurl => $baseurl,
mirrorlist => $mirrorlist,
gpgkey => $gpgkey,
target => '/etc/yum.repos.d/reposync.repo',
enabled => 0,
gpgcheck => 1,
}
# Ensure the repo dest path exists
file { "${basepath}/live/${repos_name}" :
ensure => 'directory',
owner => $repo_owner,
group => $repo_group,
mode => '0755',
}
# Create the repo configuration file
file { $conf_file:
ensure => file,
owner => $repo_owner,
group => $repo_group,
mode => '0644',
content => template('profiles/reposync/repo_conf.erb'),
require => File['/etc/reposync/conf.d'],
}
}
@@ -1,31 +0,0 @@
# setup a reposync syncer
class profiles::reposync::syncer {
include profiles::reposync::autosyncer
include profiles::reposync::autopromoter
# Ensure the reposync config path exists
file { '/etc/reposync':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
file { '/etc/reposync/conf.d':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
purge => true,
recurse => true,
force => true,
}
# get a list of repos as a hash, and iterate through them
$repos = lookup('profiles::reposync::repos_list', {})
$repos.each | String $name, Hash $repo_hash | {
profiles::reposync::repos { $name:
* => $repo_hash,
}
}
}
@@ -1,175 +0,0 @@
# setup a reposync webserver
class profiles::reposync::webserver (
String $www_root = '/data/repos/snap',
String $cache_root = '/data/repos/cache',
String $nginx_vhost = 'packagerepo.service.consul',
Stdlib::Port $nginx_port = 80,
Stdlib::Port $nginx_ssl_port = 443,
Boolean $favicon = true,
Enum['http','https','both'] $nginx_listen_mode = 'http',
Enum['puppet', 'vault'] $nginx_cert_type = 'vault'
) {
# ensure all the required directories exist
mkdir::p { $www_root: }
mkdir::p { $cache_root: }
# select the certificates to use based on cert type
case $nginx_cert_type {
'puppet': {
$selected_ssl_cert = "/etc/pki/tls/puppet/${facts['networking']['fqdn']}.crt"
$selected_ssl_key = "/etc/pki/tls/puppet/${facts['networking']['fqdn']}.key"
}
'vault': {
$selected_ssl_cert = '/etc/pki/tls/vault/certificate.crt'
$selected_ssl_key = '/etc/pki/tls/vault/private.key'
}
default: {
# enum param prevents this ever being reached
}
}
# set variables based on the listen_mode
case $nginx_listen_mode {
'http': {
$enable_ssl = false
$ssl_cert = undef
$ssl_key = undef
$listen_port = $nginx_port
$listen_ssl_port = undef
$extras_hash = {}
}
'https': {
$enable_ssl = true
$ssl_cert = $selected_ssl_cert
$ssl_key = $selected_ssl_key
$listen_port = $nginx_ssl_port
$listen_ssl_port = $nginx_ssl_port
$extras_hash = {
'subscribe' => [File[$ssl_cert], File[$ssl_key]],
}
}
'both': {
$enable_ssl = true
$ssl_cert = $selected_ssl_cert
$ssl_key = $selected_ssl_key
$listen_port = $nginx_port
$listen_ssl_port = $nginx_ssl_port
$extras_hash = {
'subscribe' => [File[$ssl_cert], File[$ssl_key]],
}
}
default: {
# enum param prevents this ever being reached
}
}
# define the default parameters for the nginx server
$defaults = {
'listen_port' => $listen_port,
'server_name' => [$nginx_vhost],
'use_default_location' => true,
'access_log' => "/var/log/nginx/${nginx_vhost}_access.log",
'error_log' => "/var/log/nginx/${nginx_vhost}_error.log",
'www_root' => $www_root,
'autoindex' => 'on',
'ssl' => $enable_ssl,
'ssl_cert' => $ssl_cert,
'ssl_key' => $ssl_key,
'ssl_port' => $listen_ssl_port,
}
# merge the hashes conditionally
$nginx_parameters = merge($defaults, $extras_hash)
# manage the nginx class
class { 'nginx':
proxy_cache_path => {
"${cache_root}/debian" => 'debian:128m',
},
proxy_cache_levels => '1:2',
proxy_cache_keys_zone => 'debian:128m',
proxy_cache_max_size => '30000m',
proxy_cache_inactive => '60d',
proxy_temp_path => "${cache_root}/tmp",
manage_repo => false,
require => [
Mkdir::P[$cache_root],
Mkdir::P[$www_root]
]
}
# create the nginx vhost with the merged parameters
create_resources('nginx::resource::server', { $nginx_vhost => $nginx_parameters })
# cache debian packages from upstream
nginx::resource::location { "${nginx_vhost}-debian":
ensure => present,
ssl => true,
ssl_only => false,
location => '/debian',
server => $nginx_vhost,
proxy => 'http://mirror.gsl.icu/debian',
}
nginx::resource::location { "${nginx_vhost}-debian_pool":
ensure => present,
ssl => true,
ssl_only => false,
location => '/debian/pool',
server => $nginx_vhost,
proxy => 'http://mirror.gsl.icu/debian/pool',
proxy_cache => 'debian',
proxy_cache_valid => [
'200 302 1440h',
'404 1m'
],
}
if $favicon {
file { "${www_root}/favicon.ico":
ensure => 'file',
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/profiles/reposync/favicon.ico',
}
}
if $::facts['os']['selinux']['config_mode'] == 'enforcing' {
# set httpd_sys_content_t to all files under the www_root
selinux::fcontext { $www_root:
ensure => 'present',
seltype => 'httpd_sys_content_t',
pathspec => "${www_root}(/.*)?",
}
# set httpd_sys_rw_content_t to all files under the cache_root
selinux::fcontext { $cache_root:
ensure => 'present',
seltype => 'httpd_sys_rw_content_t',
pathspec => "${cache_root}(/.*)?",
}
# make sure we can connect to port 80
selboolean { 'httpd_can_network_connect':
persistent => true,
value => 'on',
}
exec { "restorecon_${www_root}":
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
command => "restorecon -Rv ${www_root}",
refreshonly => true,
subscribe => Selinux::Fcontext[$www_root],
}
exec { "restorecon_${cache_root}":
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
command => "restorecon -Rv ${cache_root}",
refreshonly => true,
subscribe => Selinux::Fcontext[$cache_root],
}
}
}
+68
View File
@@ -0,0 +1,68 @@
# local rspamd milter for the mail edge gateways
# - local_d: /etc/rspamd/local.d file name => content
# - rules: /etc/rspamd/rules file name => url, re-fetched every puppet run; fetch failures keep the last good copy
class profiles::rspamd::edge (
Hash[String, String] $local_d = {},
Hash[String, Stdlib::HTTPSUrl] $rules = {},
) {
package { 'rspamd':
ensure => installed,
}
$local_d.each |$name, $content| {
file { "/etc/rspamd/local.d/${name}":
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => $content,
require => Package['rspamd'],
notify => Service['rspamd'],
}
}
file { '/etc/rspamd/rules':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
require => Package['rspamd'],
}
$rules.each |$name, $url| {
$path = "/etc/rspamd/rules/${name}"
# empty placeholder so rspamd starts before the first successful fetch
file { $path:
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => '',
replace => false,
}
# a failed or unchanged fetch skips the swap without failing the run
exec { "rspamd_rules_fetch_${name}":
command => "/usr/bin/mv -f ${path}.new ${path}",
onlyif => "/usr/bin/curl -fsS --max-time 30 -o ${path}.new ${url} && ! /usr/bin/cmp -s ${path}.new ${path}",
require => File[$path],
notify => Exec['rspamd_reload'],
}
}
# reload keeps the milter answering while config changes apply
service { 'rspamd':
ensure => running,
enable => true,
restart => '/usr/bin/systemctl reload rspamd',
require => Package['rspamd'],
}
exec { 'rspamd_reload':
command => '/usr/bin/systemctl reload rspamd',
refreshonly => true,
require => Service['rspamd'],
}
}
@@ -1,107 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
: "${DRY_RUN:=}" # set DRY_RUN=1 to preview deletions
log() { printf '[%(%F %T)T] %s\n' -1 "$*" >&2; }
# Function to create symlink for snapshots
create_symlink() {
local osname="$1" # e.g. almalinux
local release="$2" # e.g. 9.6
local repository="$3" # e.g. appstream
local basepath="$4" # e.g. /shared/apps/packagerepo
local label="$5" # monthly|weekly|daily
local date_value="$6" # YYYYMMDD for the snapshot to promote
local snap_path="${basepath}/snap/${osname}/${release}/${repository}-${date_value}"
local symlink_target="${basepath}/snap/${osname}/${release}/${repository}-${label}"
if [[ -d "$snap_path" ]]; then
ln -sfn "$snap_path" "$symlink_target"
log "Symlink set: ${symlink_target} -> ${snap_path}"
return 0
else
log "Snapshot path does not exist: $snap_path"
return 1
fi
}
# Cleanup snapshot directories older than a cutoff date (YYYYMMDD)
cleanup_older_than_monthly() {
local osname="$1"
local release="$2"
local repository="$3"
local basepath="$4"
local cutoff_date="$5" # newly promoted monthly date, YYYYMMDD
local root="${basepath}/snap/${osname}/${release}"
local pattern="${repository}-"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]
shopt -s nullglob
for dir in "${root}"/${pattern}; do
# Skip symlinks and non-directories
[[ -L "$dir" ]] && continue
[[ -d "$dir" ]] || continue
# Extract the date suffix
local name base datepart
name="$(basename -- "$dir")"
base="${name%-????????}" # remove last 8 chars
datepart="${name#${base}-}" # after "<repo>-"
# Only act on valid YYYYMMDD dates
if [[ "$datepart" =~ ^[0-9]{8}$ ]]; then
if [[ "$datepart" -lt "$cutoff_date" ]]; then
if [[ -n "${DRY_RUN}" ]]; then
log "[DRY_RUN] Would remove: $dir"
else
log "Removing: $dir"
rm -rf --one-file-system -- "$dir"
fi
fi
fi
done
shopt -u nullglob
}
# Determine which snapshot to promote based on the passed argument
case "${1:-}" in
monthly)
promote_date=$(date --date="$(date +%Y%m01) -1 month" +%Y%m%d)
;;
weekly)
promote_date=$(date --date="last Sunday" +%Y%m%d)
;;
daily)
promote_date=$(date --date="yesterday" +%Y%m%d)
;;
*)
echo "Usage: $0 {monthly|weekly|daily}"
exit 1
;;
esac
label="$1"
# Process each repo conf
for conf in /etc/reposync/conf.d/*.conf; do
# shellcheck disable=SC1090
source "$conf"
# Expecting these vars in the conf: OSNAME, RELEASE, REPOSITORY, BASEPATH
: "${OSNAME:?missing OSNAME in $conf}"
: "${RELEASE:?missing RELEASE in $conf}"
: "${REPOSITORY:?missing REPOSITORY in $conf}"
: "${BASEPATH:?missing BASEPATH in $conf}"
# 1) Promote the symlink for this label
if create_symlink "$OSNAME" "$RELEASE" "$REPOSITORY" "$BASEPATH" "$label" "$promote_date"; then
# 2) If monthly, clean up older snapshot dirs for this repo
if [[ "$label" == "monthly" ]]; then
cleanup_older_than_monthly "$OSNAME" "$RELEASE" "$REPOSITORY" "$BASEPATH" "$promote_date"
fi
else
log "Skipping cleanup for ${OSNAME}/${RELEASE}/${REPOSITORY} due to missing ${REPOSITORY}-${promote_date}"
fi
done
@@ -1,97 +0,0 @@
#!/usr/bin/bash
# Function to perform reposync
perform_reposync() {
local reponame="$1"
local basepath="$2"
/usr/bin/dnf reposync \
--gpgcheck \
--delete \
--downloadcomps \
--download-metadata \
--remote-time \
--disablerepo="*" \
--enablerepo="${reponame}" \
--download-path="${basepath}/live"
}
# Function to download GPG keys
download_gpg_key() {
local gpgkeyurl="$1"
local reponame="$2"
local basepath="$3"
# Extract filename from URL
local filename=$(basename "$gpgkeyurl")
# Download GPG key to the specified path with the filename from the URL
curl -s --create-dirs -o "${basepath}/live/${reponame}/${filename}" "$gpgkeyurl" || {
echo "Failed to download GPG key from $gpgkeyurl"
}
# import the gpg key
rpm --import "${basepath}/live/${reponame}/${filename}" || echo "Failed to import gpg key ${basepath}/live/${reponame}/${filename}"
}
# Function to perform rsync with hard links
perform_rsync() {
local source_path="$1"
local dest_path="$2"
# Create the destination directory if it doesn't exist
mkdir -p "$dest_path"
# Use rsync to create hard links to the files in the destination directory
rsync -a --link-dest="$source_path" "$source_path"/* "$dest_path"
}
create_repo_metadata() {
local repo_path="${1}"
if [[ -d "$repo_path" ]]; then
echo "Running createrepo on ${repo_path}..."
createrepo --update "${repo_path}"
if [[ $? -eq 0 ]]; then
echo "Successfully created repository metadata for ${repo_path}"
else
echo "Failed to create repository metadata for ${repo_path}" >&2
return 1
fi
else
echo "The specified repository path does not exist: ${repo_path}" >&2
return 1
fi
}
# Current date in the required format
DATE=$(date +%Y%m%d)
# iterate over each configuration file
for conf in /etc/reposync/conf.d/*.conf; do
# source the configuration to get the variables
source "$conf"
# Call the function to download the GPG key
download_gpg_key "$GPGKEYURL" "$REPONAME" "$BASEPATH"
# Call the reposync function
perform_reposync "$REPONAME" "$BASEPATH"
# Path for rsync source
live_path="${BASEPATH}/live/${REPONAME}"
# Path for rsync destination
snap_path="${BASEPATH}/snap/${OSNAME}/${RELEASE}/${REPOSITORY}-${DATE}/${ARCH}/os"
# Call the rsync function
perform_rsync "$live_path" "$snap_path"
# After syncing each repo, fix the repository metadata
create_repo_metadata "${snap_path}"
# Update selinux
restorecon -R ${snap_path}
done
@@ -1,8 +0,0 @@
# <%= @osname %>-<%= @release %>-<%= @repository %> repository configuration
REPOSITORY="<%= @repository %>"
REPONAME="<%= @repos_name %>"
OSNAME="<%= @osname %>"
RELEASE="<%= @release %>"
ARCH="<%= @arch %>"
BASEPATH="<%= @basepath %>"
GPGKEYURL="<%= @gpgkey %>"
@@ -6,6 +6,11 @@ class roles::infra::mail::gateway {
}else{
include profiles::defaults
include profiles::base
include dnsmasq
include profiles::rspamd::edge
include profiles::postfix::gateway
# resolv.conf points at dnsmasq, so it must be running first
Class['dnsmasq'] -> Class['profiles::dns::resolvconf']
}
}
@@ -1,11 +0,0 @@
# a role to deploy the webserver for packagerepo
class roles::infra::reposync::repo {
if $facts['firstrun'] {
include profiles::defaults
include profiles::firstrun::init
}else{
include profiles::defaults
include profiles::base
include profiles::base::datavol
}
}
@@ -1,12 +0,0 @@
# a role to deploy the syncer/promoter for packagerepo
class roles::infra::reposync::syncer {
if $facts['firstrun'] {
include profiles::defaults
include profiles::firstrun::init
}else{
include profiles::defaults
include profiles::base
include profiles::base::datavol
include profiles::reposync::syncer
}
}