Compare commits
69 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c9599ef954 | |||
| 12dd9a5155 | |||
| cc5d2d872d | |||
| 869821e73f | |||
| 6cf396ced8 | |||
| c6e411a027 | |||
| 89bd97048e | |||
| e057ca9147 | |||
| 81262ee73e | |||
| 7682c654c0 | |||
| f6f93d855e | |||
| 42c4e41508 | |||
| bd126a0d1e | |||
| 9a4dbd82ac | |||
| badfb70a4b | |||
| efe15ec078 | |||
| 452acfacd9 | |||
| a5ed2c278e | |||
| aa125b5e83 | |||
| a250d30d7d | |||
| e90884507b | |||
| 49c14e7bda | |||
| 3726210d38 | |||
| 8e2497d612 | |||
| 7605623aa8 | |||
| 1961a049f3 | |||
| faf96a1dca | |||
| e6a06f4845 | |||
| a14cdbb55a | |||
| b338c8420a | |||
| b1f2fff045 | |||
| 4313b7db49 | |||
| 693452b4f8 | |||
| 6c880d9794 | |||
| 2e95cd00d7 | |||
| 171cf23a93 | |||
| 83cb039b97 | |||
| fc26d3cc4a | |||
| 5fe9f7a9da | |||
| 18fd966f92 | |||
| b74bced771 | |||
| 0cfe598f90 | |||
| 0272104504 | |||
| 1ed268acda | |||
| 47e3bdc8f5 | |||
| 410a1f13d0 | |||
| ec74484d89 | |||
| c0e65fade3 | |||
| 1c01b7e6ca | |||
| cb9f8870bf | |||
| 734fcb8cf4 | |||
| f933660d3b | |||
| 3370aff38f | |||
| 1a907467e9 | |||
| cf25a20a92 | |||
| 979c188c34 | |||
| 7e1f2c336c | |||
| 2a329058c0 | |||
| 7102ef2b34 | |||
| d859daead4 | |||
| 0fd01ac1a7 | |||
| 62dff97c98 | |||
| ff1a30823c | |||
| 804ea06499 | |||
| 0fdc7c97d8 | |||
| 499251575d | |||
| 10854b6501 | |||
| 895ca5b1cb | |||
| caf27e90bd |
@@ -0,0 +1,4 @@
|
||||
/.github/workflows/ @IUCLabs/maintainers
|
||||
/Makefile @IUCLabs/maintainers
|
||||
/.pre-commit-config.yaml @IUCLabs/maintainers
|
||||
/.github/CODEOWNERS @IUCLabs/maintainers
|
||||
+8
-31
@@ -88,36 +88,13 @@
|
||||
|
||||
# SSH Hostkey Signing
|
||||
|
||||
## create ssh engine, key, set ttl
|
||||
vault secrets enable -path=ssh-host-signer ssh
|
||||
vault write ssh-host-signer/config/ca generate_signing_key=true
|
||||
vault secrets tune -max-lease-ttl=87600h ssh-host-signer
|
||||
The `sshca` ssh engine, its `signhost` role, the `sshca/sign/signhost` policy and
|
||||
the `sshsigner` approle are managed in terraform-vault:
|
||||
|
||||
## create role
|
||||
vault write ssh-host-signer/roles/hostrole \
|
||||
key_type=ca \
|
||||
algorithm_signer=rsa-sha2-256 \
|
||||
ttl=87600h \
|
||||
allow_host_certificates=true \
|
||||
allowed_domains="unkin.net" \
|
||||
allow_subdomains=true \
|
||||
allow_baredomains=true
|
||||
- `config/ssh_secret_backend/sshca.yaml`
|
||||
- `config/ssh_secret_backend_role/sshca/signhost.yaml`
|
||||
- `config/auth_approle_role/approle/sshsigner.yaml`
|
||||
- `policies/sshca/sign/signhost.yaml`
|
||||
|
||||
## create policy to use hostrole
|
||||
cat <<EOF > sshsign-host.hcl
|
||||
path "ssh-host-signer/sign/hostrole" {
|
||||
capabilities = ["create", "update"]
|
||||
}
|
||||
EOF
|
||||
|
||||
vault policy write sshsign-host-policy sshsign-host.hcl
|
||||
|
||||
vault write auth/approle/role/sshsign-host-role \
|
||||
bind_secret_id=false \
|
||||
token_policies="sshsign-host-policy" \
|
||||
token_ttl=30s \
|
||||
token_max_ttl=30s \
|
||||
token_bound_cidrs="198.18.17.3/32,198.18.13.32/32,198.18.13.33/32,198.18.13.34/32"
|
||||
|
||||
## get the sshsign-host-role approle id
|
||||
vault read -field=role_id auth/approle/role/sshsign-host-role/role-id
|
||||
## get the sshsigner approle id
|
||||
vault read -field=role_id auth/approle/role/sshsigner/role-id
|
||||
|
||||
+51
-1
@@ -178,6 +178,8 @@ lookup_options:
|
||||
convert_to: Sensitive
|
||||
stalwart::fallback_admin_password:
|
||||
convert_to: Sensitive
|
||||
wireguard::interfaces:
|
||||
convert_to: Sensitive
|
||||
|
||||
facts_path: '/opt/puppetlabs/facter/facts.d'
|
||||
|
||||
@@ -367,6 +369,7 @@ ssh::server::options:
|
||||
|
||||
profiles::ssh::knownhosts::lines:
|
||||
- '@cert-authority * ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1HD97vYxLTniE4qNpGuftUlvmkEXIuX8+7nbENv/IzsGUghEDRtyThjQ7ojNKIsQ7f8wXr0gMcI+fAPfrbcOMHCAoYMomikwL0b3h95SZI40q3CyM+0DMnwiVVDX6C1QxkO2Rv9cszSkCa85NotJhXiUuTBI9BFcRPy+mAhbpAru+bfypYofI0wW97XNTl8Jgwmni5MgutBIQAokFIn5ux8iWxndCH3AqDtmkwC5DfQeQ+wZx7rkwqJEpJffQzrjb1gIM6P9hDCVBBVPh/3o80IJ69rFWrJAZUb+JpG4cXJH0NcSW+wqc3JCT/x3q8VlHwOTXSlNNKtOJCRx73mB8e1XTTy2a9FgpKDDg5XQXWHAViJDz1RTRL9gRefMylRgKz4bXoTuY9kJWM8hPTyUejtukbJThlBJc3OmDxBZBF7F0iqB11pHexok43OCEiANodVa36eWu9/5X032Vm48fZ1/akDPY/NSy3wAn7kwut+A0/JAHFHASrq+1mt9YurkJegI+YHXO6eEWpBIpmI7ORHJbGL4MhkHrxYzVamuP8CkU7tXzsv138+wpOcRHNp9yJY4PT40BZkRf/O3O+jt3pj9Dj8rvgywF2W6hFzywh3Y78upOprRkQlQtHfsI8EyrYI8/hUw2u3H+3yPXh3YjWfqvWVG1BRLRHBV7m90uaw=='
|
||||
- '@cert-authority * ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDi80G0GtKMdRj4azPwxbJW46NG0y8seSVSnvFm2Ka/nckdUb/3lRlQuPYf1tkbqqFlcXjDM8+u0tzM2kLsgfn0Dpujm1fuoA66yGGweBjtxLFErH5+6+/KND5I9w8LMY2AtVztnBk/CVx8RwgrooABDRZiBH7OOAOpJqqFI7LvEsv61zC0nAqbYJ8uxfx+r4lJ9dUhK1woitEqC4npSRUn5KJK+KAEd7AzcUkZb6TO9A3oRPz1nQ/qU+QNMmVUi+wRj9kJR18mxErugyLLTNcFDBqSdHNun3eUNBUmoS2cAa8ZVscOLzbUGejVK9UY06Q7wu+J34Fzl8CN5tBqRHGZ3ykqGZ6gG+O0Egr9Rm3Obgkujpio2uTh27LhBy72vjgJ8kTFmPlzANTJFpKlsy91usSFPh8WZeIo6VpPLqnC32rjfNkfqHyPAeJ3+rdOkUZoDjMoZc3wxxLZTgMU5ud1w4LxQNRkNiaT/tRRNQF8o+pygkS7xxKduBBMzYdRS1OifaS4gyvP82oOyquWywhyFNtG7ph8FQwc34puM7FyxfaJ0XL/+zAfPMhDoOojvofADJo73R+FgVyer+mCJw4KtWJ4JzZrNTYz1Xl8WlhF8RDzOYfSH46qzJFa9FcRqgP4LUkgzdvcQ+1hBFpvpHtw3vl3DiqtZDDbK9SyrEtdnw=='
|
||||
|
||||
profiles::base::groups::local:
|
||||
admins:
|
||||
@@ -400,7 +403,15 @@ networking::route_defaults:
|
||||
|
||||
# logging:
|
||||
victorialogs::client::journald::enable: true
|
||||
victorialogs::client::journald::inserturl: https://vlinsert.service.consul:9428/insert/journald
|
||||
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
|
||||
@@ -409,6 +420,45 @@ profiles::ceph::client::mons:
|
||||
- 10.18.15.2
|
||||
- 10.18.15.3
|
||||
|
||||
# de96a98f cluster topology (prodnxsr0001-0019) - single source of truth for
|
||||
# /etc/ceph/ceph.conf rendered by profiles::ceph::client on the k8s (osd) and
|
||||
# incus (mon/mgr/mds) roles. fsid/mons are overridden per-role in the role hiera.
|
||||
# public_network is the /32 of every ceph host's ceph-public loopback.
|
||||
profiles::ceph::client::cluster_public_ips:
|
||||
- 198.18.23.1
|
||||
- 198.18.23.2
|
||||
- 198.18.23.3
|
||||
- 198.18.23.4
|
||||
- 198.18.23.5
|
||||
- 198.18.23.6
|
||||
- 198.18.23.7
|
||||
- 198.18.23.8
|
||||
- 198.18.23.9
|
||||
- 198.18.23.10
|
||||
- 198.18.23.11
|
||||
- 198.18.23.12
|
||||
- 198.18.23.13
|
||||
- 198.18.23.14
|
||||
- 198.18.23.15
|
||||
- 198.18.23.16
|
||||
- 198.18.23.17
|
||||
- 198.18.23.18
|
||||
- 198.18.23.19
|
||||
profiles::ceph::client::mon_initial_members:
|
||||
- prodnxsr0009
|
||||
- prodnxsr0010
|
||||
- prodnxsr0011
|
||||
- prodnxsr0012
|
||||
- prodnxsr0013
|
||||
# two mds daemon instances per mon/mgr/mds host (rendered only where
|
||||
# render_mds_config is true, i.e. the incus node role).
|
||||
profiles::ceph::client::mds_instances:
|
||||
prodnxsr0009: 2
|
||||
prodnxsr0010: 2
|
||||
prodnxsr0011: 2
|
||||
prodnxsr0012: 2
|
||||
prodnxsr0013: 2
|
||||
|
||||
profiles::ceph::conf::config:
|
||||
global:
|
||||
auth_client_required: 'cephx'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -3,23 +3,7 @@ haproxy_server_k8s_syd1_traefik_internal: 'k8s-traefik-internal 198.18.200.4:443
|
||||
haproxy_server_k8s_syd1_traefik_external: 'k8s-traefik-external 198.18.199.0:443 ssl verify none check inter 2s rise 3 fall 2'
|
||||
|
||||
profiles::haproxy::dns::ipaddr: "%{hiera('anycast_ip')}"
|
||||
profiles::haproxy::dns::vrrp_cnames:
|
||||
- sonarr.main.unkin.net
|
||||
- radarr.main.unkin.net
|
||||
- lidarr.main.unkin.net
|
||||
- readarr.main.unkin.net
|
||||
- prowlarr.main.unkin.net
|
||||
- nzbget.main.unkin.net
|
||||
- git.unkin.net
|
||||
- fafflix.unkin.net
|
||||
- grafana.unkin.net
|
||||
- dashboard.ceph.unkin.net
|
||||
- mail-webadmin.main.unkin.net
|
||||
- mail-in.main.unkin.net
|
||||
- mail.main.unkin.net
|
||||
- autoconfig.main.unkin.net
|
||||
- autodiscover.main.unkin.net
|
||||
- auth.unkin.net
|
||||
profiles::haproxy::dns::vrrp_cnames: []
|
||||
|
||||
profiles::haproxy::mappings:
|
||||
fe_http:
|
||||
@@ -432,9 +416,7 @@ profiles::pki::vault::alt_names:
|
||||
- mail-webadmin.main.unkin.net
|
||||
|
||||
# additional cnames
|
||||
profiles::haproxy::dns::cnames:
|
||||
- au-syd1-pve.main.unkin.net
|
||||
- au-syd1-pve-api.main.unkin.net
|
||||
profiles::haproxy::dns::cnames: []
|
||||
|
||||
# letsencrypt certificates
|
||||
certbot::client::service: haproxy
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
networking_loopback0_ip: 198.18.19.21 # management loopback
|
||||
networking_loopback1_ip: 198.18.22.14 # ceph-cluster loopback
|
||||
networking_loopback2_ip: 198.18.23.14 # ceph-public loopback
|
||||
networking_1000_ip: 198.18.15.14 # 1gbe network
|
||||
networking_2500_ip: 198.18.21.14 # 2.5gbe network
|
||||
networking_1000_iface: enp1s0
|
||||
networking_2500_iface: enp2s0
|
||||
networking::interfaces:
|
||||
"%{hiera('networking_1000_iface')}":
|
||||
mac: a4:bb:6d:a4:e5:c1
|
||||
"%{hiera('networking_2500_iface')}":
|
||||
mac: c4:62:37:0d:50:03
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
networking_loopback0_ip: 198.18.19.22 # management loopback
|
||||
networking_loopback1_ip: 198.18.22.15 # ceph-cluster loopback
|
||||
networking_loopback2_ip: 198.18.23.15 # ceph-public loopback
|
||||
networking_1000_ip: 198.18.15.15 # 1gbe network
|
||||
networking_2500_ip: 198.18.21.15 # 2.5gbe network
|
||||
networking_1000_iface: enp1s0
|
||||
networking_2500_iface: enp2s0
|
||||
networking::interfaces:
|
||||
"%{hiera('networking_1000_iface')}":
|
||||
mac: a4:bb:6d:a6:30:c4
|
||||
"%{hiera('networking_2500_iface')}":
|
||||
mac: c4:62:37:0d:4f:f4
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
networking_loopback0_ip: 198.18.19.23 # management loopback
|
||||
networking_loopback1_ip: 198.18.22.16 # ceph-cluster loopback
|
||||
networking_loopback2_ip: 198.18.23.16 # ceph-public loopback
|
||||
networking_1000_ip: 198.18.15.16 # 1gbe network
|
||||
networking_2500_ip: 198.18.21.16 # 2.5gbe network
|
||||
networking_1000_iface: enp1s0
|
||||
networking_2500_iface: enp2s0
|
||||
networking::interfaces:
|
||||
"%{hiera('networking_1000_iface')}":
|
||||
mac: a4:bb:6d:9f:22:13
|
||||
"%{hiera('networking_2500_iface')}":
|
||||
mac: c4:62:37:0d:50:0c
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
networking_loopback0_ip: 198.18.19.24 # management loopback
|
||||
networking_loopback1_ip: 198.18.22.17 # ceph-cluster loopback
|
||||
networking_loopback2_ip: 198.18.23.17 # ceph-public loopback
|
||||
networking_1000_ip: 198.18.15.17 # 1gbe network
|
||||
networking_2500_ip: 198.18.21.17 # 2.5gbe network
|
||||
networking_1000_iface: enp1s0
|
||||
networking_2500_iface: enp2s0
|
||||
networking::interfaces:
|
||||
"%{hiera('networking_1000_iface')}":
|
||||
mac: 8c:04:ba:9c:b6:08
|
||||
"%{hiera('networking_2500_iface')}":
|
||||
mac: c4:62:37:0d:50:12
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
networking_loopback0_ip: 198.18.19.25 # management loopback
|
||||
networking_loopback1_ip: 198.18.22.18 # ceph-cluster loopback
|
||||
networking_loopback2_ip: 198.18.23.18 # ceph-public loopback
|
||||
networking_1000_ip: 198.18.15.18 # 1gbe network
|
||||
networking_2500_ip: 198.18.21.18 # 2.5gbe network
|
||||
networking_1000_iface: enp1s0
|
||||
networking_2500_iface: enp2s0
|
||||
networking::interfaces:
|
||||
"%{hiera('networking_1000_iface')}":
|
||||
mac: a4:bb:6d:a4:db:94
|
||||
"%{hiera('networking_2500_iface')}":
|
||||
mac: c4:62:37:0d:4f:fa
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
networking_loopback0_ip: 198.18.19.26 # management loopback
|
||||
networking_loopback1_ip: 198.18.22.19 # ceph-cluster loopback
|
||||
networking_loopback2_ip: 198.18.23.19 # ceph-public loopback
|
||||
networking_1000_ip: 198.18.15.19 # 1gbe network
|
||||
networking_2500_ip: 198.18.21.19 # 2.5gbe network
|
||||
networking_1000_iface: enp1s0
|
||||
networking_2500_iface: enp2s0
|
||||
networking::interfaces:
|
||||
"%{hiera('networking_1000_iface')}":
|
||||
mac: a4:bb:6d:a4:56:11
|
||||
"%{hiera('networking_2500_iface')}":
|
||||
mac: c4:62:37:0d:50:00
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
# primary interface is the WAN uplink; pin host identity to the dum0 loopback
|
||||
networking_loopback0_ip: 198.18.2.160
|
||||
networking_loopback1_ip: 198.18.21.160
|
||||
|
||||
# dns: keep the local dnsmasq resolver
|
||||
profiles::dns::base::nameservers:
|
||||
- 127.0.0.1
|
||||
profiles::dns::base::search:
|
||||
- main.unkin.net
|
||||
profiles::dns::base::primary_interface: dum0
|
||||
profiles::dns::updater::deny_ranges:
|
||||
- 198.18.199.0/24
|
||||
- 198.18.200.0/24
|
||||
- 10.42.0.0/16
|
||||
- 10.43.0.0/16
|
||||
- 10.10.12.0/24 # wg0
|
||||
- 103.216.190.0/23 # wan uplink
|
||||
profiles::consul::client::host_addr: "%{hiera('networking_loopback0_ip')}"
|
||||
|
||||
# ssh: listen on localhost and dum0 only; knock out the common wan primary ip
|
||||
lookup_options:
|
||||
ssh::server::options:
|
||||
merge:
|
||||
strategy: deep
|
||||
knockout_prefix: '--'
|
||||
ssh::server::options:
|
||||
ListenAddress:
|
||||
- "--%{facts.networking.ip}"
|
||||
- 127.0.0.1
|
||||
- "%{hiera('networking_loopback0_ip')}"
|
||||
profiles::ssh::sign::principals:
|
||||
- "%{hiera('networking_loopback0_ip')}"
|
||||
|
||||
# frrouting
|
||||
frrouting::ospfd_router_id: "%{hiera('networking_loopback0_ip')}"
|
||||
frrouting::ospfd_interfaces:
|
||||
dum0:
|
||||
area: 0.0.0.0
|
||||
dum1:
|
||||
area: 0.0.0.0
|
||||
bond0.201:
|
||||
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
|
||||
@@ -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
|
||||
@@ -77,6 +76,7 @@ profiles::yum::global::repos:
|
||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/local/rpm-internal/
|
||||
gpgcheck: false
|
||||
mirrorlist: absent
|
||||
metadata_expire: '60'
|
||||
rpm-vendor:
|
||||
name: rpm-vendor
|
||||
descr: rpm-vendor repository
|
||||
@@ -84,6 +84,7 @@ profiles::yum::global::repos:
|
||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/local/rpm-vendor/
|
||||
gpgcheck: false
|
||||
mirrorlist: absent
|
||||
metadata_expire: '60'
|
||||
# Per-release variants, resolved from the host's EL major version so el8
|
||||
# hosts pull rpm-internal-el8/rpm-vendor-el8, el9 hosts el9, etc.
|
||||
rpm-internal-release:
|
||||
@@ -93,6 +94,7 @@ profiles::yum::global::repos:
|
||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/local/rpm-internal-el%{facts.os.release.major}/
|
||||
gpgcheck: false
|
||||
mirrorlist: absent
|
||||
metadata_expire: '60'
|
||||
rpm-vendor-release:
|
||||
name: rpm-vendor-el%{facts.os.release.major}
|
||||
descr: rpm-vendor-el%{facts.os.release.major} repository
|
||||
@@ -100,6 +102,15 @@ profiles::yum::global::repos:
|
||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/local/rpm-vendor-el%{facts.os.release.major}/
|
||||
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
|
||||
@@ -120,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
|
||||
@@ -143,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
|
||||
|
||||
@@ -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).
|
||||
@@ -60,6 +56,7 @@ profiles::yum::global::repos:
|
||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/local/rpm-internal-f%{facts.os.release.major}/
|
||||
gpgcheck: false
|
||||
mirrorlist: absent
|
||||
metadata_expire: '60'
|
||||
rpm-vendor:
|
||||
name: rpm-vendor-f%{facts.os.release.major}
|
||||
descr: rpm-vendor-f%{facts.os.release.major} repository
|
||||
@@ -67,3 +64,12 @@ profiles::yum::global::repos:
|
||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/local/rpm-vendor-f%{facts.os.release.major}/
|
||||
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,6 +2,8 @@
|
||||
hiera_include:
|
||||
- profiles::nginx::simpleproxy
|
||||
|
||||
profiles::puppet::migrate::enabled: true
|
||||
|
||||
profiles::yum::global::repos:
|
||||
ceph:
|
||||
ensure: present
|
||||
@@ -65,6 +67,9 @@ profiles::nginx::simpleproxy::locations:
|
||||
- 127.0.0.1
|
||||
- "%{facts.networking.ip}"
|
||||
- 198.18.24.0/24
|
||||
- 198.18.21.0/24
|
||||
- 198.18.15.0/24
|
||||
- 198.18.19.0/24
|
||||
location_deny:
|
||||
- all
|
||||
# authorised access from external
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
hiera_include:
|
||||
- glauth
|
||||
|
||||
profiles::puppet::migrate::enabled: true
|
||||
|
||||
# additional altnames
|
||||
profiles::pki::vault::alt_names:
|
||||
- ldap.main.unkin.net
|
||||
|
||||
@@ -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: {}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -203,7 +205,9 @@ profiles::accounts::sysadmin::extra_groups:
|
||||
- incus-admin
|
||||
|
||||
# manage cephfs mounts
|
||||
profiles::ceph::client::manage_ceph_conf: false
|
||||
profiles::ceph::client::manage_ceph_conf: true
|
||||
# mon/mgr/mds host: render the [mds] + [mds.*] sections
|
||||
profiles::ceph::client::render_mds_config: true
|
||||
profiles::ceph::client::manage_ceph_package: false
|
||||
profiles::ceph::client::manage_ceph_paths: false
|
||||
profiles::ceph::client::fsid: 'de96a98f-3d23-465a-a899-86d3d67edab8'
|
||||
|
||||
@@ -8,9 +8,13 @@ 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
|
||||
# pull the airgap image bundle via artifactapi (host-reachable pre-CNI), not github directly
|
||||
rke2::container_archive_source: 'https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/github/rancher/rke2/releases/download'
|
||||
rke2::manage_registries: true
|
||||
rke2::registries:
|
||||
docker.io:
|
||||
@@ -90,7 +94,7 @@ profiles::packages::include:
|
||||
|
||||
profiles::selinux::setenforce::mode: disabled
|
||||
|
||||
profiles::ceph::client::manage_ceph_conf: false
|
||||
profiles::ceph::client::manage_ceph_conf: true
|
||||
profiles::ceph::client::manage_ceph_package: false
|
||||
profiles::ceph::client::manage_ceph_paths: false
|
||||
profiles::ceph::client::fsid: 'de96a98f-3d23-465a-a899-86d3d67edab8'
|
||||
|
||||
@@ -30,6 +30,9 @@ rke2::config_hash:
|
||||
- '--node-monitor-period=4s'
|
||||
protect-kernel-defaults: true
|
||||
disable-kube-proxy: false
|
||||
# taint the control-plane/etcd nodes so only tolerating workloads schedule here
|
||||
node-taint:
|
||||
- "node-role.kubernetes.io/control-plane=true:NoSchedule"
|
||||
|
||||
# configure consul service
|
||||
consul::services:
|
||||
|
||||
@@ -33,7 +33,7 @@ profiles::packages::include:
|
||||
|
||||
profiles::selinux::setenforce::mode: disabled
|
||||
|
||||
profiles::ceph::client::manage_ceph_conf: false
|
||||
profiles::ceph::client::manage_ceph_conf: true
|
||||
profiles::ceph::client::manage_ceph_package: false
|
||||
profiles::ceph::client::manage_ceph_paths: false
|
||||
profiles::ceph::client::fsid: 'de96a98f-3d23-465a-a899-86d3d67edab8'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
hiera_include:
|
||||
- frrouting
|
||||
- exporters::frr_exporter
|
||||
- profiles::metrics::ntopng
|
||||
|
||||
profiles::puppet::migrate::enabled: true
|
||||
|
||||
# routing
|
||||
sysctl::base::values:
|
||||
net.ipv4.ip_forward:
|
||||
value: '1'
|
||||
net.ipv4.conf.all.rp_filter:
|
||||
value: '0'
|
||||
net.ipv4.conf.default.rp_filter:
|
||||
value: '0'
|
||||
# overrides 50-redhat.conf's per-interface rp_filter=1 (applied by udev on link add); sysctl -n can't glob, so no enforce
|
||||
net.ipv4.conf.*.rp_filter:
|
||||
value: '0'
|
||||
enforce: false
|
||||
|
||||
# frrouting
|
||||
exporters::frr_exporter::enable: true
|
||||
frrouting::ospfd_redistribute:
|
||||
- connected
|
||||
frrouting::daemons:
|
||||
ospfd: true
|
||||
|
||||
# consul
|
||||
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,3 +1,5 @@
|
||||
profiles::puppet::migrate::enabled: true
|
||||
|
||||
profiles::pki::vault::alt_names:
|
||||
- jumphost.service.consul
|
||||
- jumphost.query.consul
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
profiles::puppet::autosign::subnet_ranges:
|
||||
- '198.18.2.0/24'
|
||||
- '198.18.13.0/24'
|
||||
- '198.18.14.0/24'
|
||||
- '198.18.15.0/24'
|
||||
@@ -26,6 +27,19 @@ profiles::puppet::cobbler_enc::packages:
|
||||
- 'requests'
|
||||
- 'PyYAML'
|
||||
profiles::puppet::enc::repo: https://git.service.au-syd1.consul/unkinben/puppet-enc.git
|
||||
|
||||
# Deep-merged with the entries in roles/infra/puppet.yaml.
|
||||
profiles::packages::include:
|
||||
encapic:
|
||||
ensure: '0.5.0'
|
||||
certmanager:
|
||||
ensure: '0.2.0'
|
||||
sshsignhost:
|
||||
ensure: '0.1.0'
|
||||
|
||||
profiles::puppet::encapic::encapi_url: https://encapi.k8s.syd1.au.unkin.net
|
||||
profiles::puppet::server::external_nodes: '/usr/bin/encapic-enc'
|
||||
|
||||
profiles::puppet::r10k::r10k_repo: https://git.unkin.net/unkin/puppet-r10k.git
|
||||
profiles::puppet::g10k::bin_path: '/usr/bin/g10k'
|
||||
profiles::puppet::g10k::cfg_path: '/etc/puppetlabs/r10k/r10k.yaml'
|
||||
@@ -47,10 +61,9 @@ profiles::helpers::certmanager::vault_config:
|
||||
|
||||
profiles::helpers::sshsignhost::vault_config:
|
||||
addr: 'https://vault.service.consul:8200'
|
||||
mount_point: 'ssh-host-signer'
|
||||
mount_point: 'sshca'
|
||||
approle_path: 'approle'
|
||||
role_name: 'hostrole'
|
||||
output_path: '/tmp/sshsignhost'
|
||||
role_name: 'signhost'
|
||||
role_id: "%{lookup('sshsignhost::role_id')}"
|
||||
|
||||
profiles::puppet::server::agent_server: 'puppet.query.consul'
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
@@ -40,3 +42,11 @@ profiles::packages::include:
|
||||
ensure: '0.1.1'
|
||||
openbao-plugin-secrets-gitea:
|
||||
ensure: '0.1.0'
|
||||
openbao-plugin-secrets-apptoken:
|
||||
ensure: '0.1.0'
|
||||
openbao-plugin-secrets-netbox:
|
||||
ensure: '0.1.0'
|
||||
openbao-plugin-secrets-ghp:
|
||||
ensure: '0.1.0'
|
||||
openbao-plugin-secrets-arrstack:
|
||||
ensure: '0.2.0'
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
---
|
||||
# physical hosts only (facts.virtual == 'physical'); merged 'unique' with the
|
||||
# common hiera_include in profiles::base.
|
||||
hiera_include:
|
||||
- profiles::lldpd
|
||||
|
||||
profiles::packages::include:
|
||||
"%{hiera('lm-sensors::package')}": {}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# manage dnsmasq as a dns forwarder and dhcp relay
|
||||
class dnsmasq (
|
||||
Boolean $manage_package = true,
|
||||
Boolean $manage_service = true,
|
||||
String $package_name = 'dnsmasq',
|
||||
String $service_name = 'dnsmasq',
|
||||
Stdlib::Absolutepath $config_file = '/etc/dnsmasq.conf',
|
||||
Stdlib::Absolutepath $config_dir = '/etc/dnsmasq.d',
|
||||
Boolean $purge_config_dir = false,
|
||||
Array[String] $interfaces = [],
|
||||
Array[Stdlib::IP::Address] $listen_addresses = ['127.0.0.1'],
|
||||
Enum['bind-interfaces', 'bind-dynamic', 'none'] $bind_mode = 'bind-interfaces',
|
||||
Boolean $no_resolv = false,
|
||||
Array[String] $servers = [],
|
||||
Hash[String, Array[String]] $forwards = {},
|
||||
Optional[Integer[0]] $cache_size = undef,
|
||||
Boolean $domain_needed = true,
|
||||
Boolean $bogus_priv = true,
|
||||
Array[String] $dhcp_relays = [],
|
||||
Array[String] $options = [],
|
||||
) {
|
||||
|
||||
if $manage_package {
|
||||
package { $package_name:
|
||||
ensure => installed,
|
||||
before => File[$config_file, $config_dir],
|
||||
}
|
||||
}
|
||||
|
||||
file { $config_dir:
|
||||
ensure => directory,
|
||||
recurse => $purge_config_dir,
|
||||
purge => $purge_config_dir,
|
||||
}
|
||||
|
||||
file { $config_file:
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
content => template('dnsmasq/dnsmasq.conf.erb'),
|
||||
}
|
||||
|
||||
if $manage_service {
|
||||
service { $service_name:
|
||||
ensure => running,
|
||||
enable => true,
|
||||
subscribe => File[$config_file, $config_dir],
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
# THIS FILE IS MANAGED BY PUPPET
|
||||
user=dnsmasq
|
||||
group=dnsmasq
|
||||
conf-dir=<%= @config_dir %>,.rpmnew,.rpmsave,.rpmorig
|
||||
|
||||
<% @interfaces.each do |iface| -%>
|
||||
interface=<%= iface %>
|
||||
<% end -%>
|
||||
<% unless @listen_addresses.empty? -%>
|
||||
listen-address=<%= @listen_addresses.join(',') %>
|
||||
<% end -%>
|
||||
<% unless @bind_mode == 'none' -%>
|
||||
<%= @bind_mode %>
|
||||
<% end -%>
|
||||
<% if @no_resolv -%>
|
||||
no-resolv
|
||||
<% end -%>
|
||||
<% if @domain_needed -%>
|
||||
domain-needed
|
||||
<% end -%>
|
||||
<% if @bogus_priv -%>
|
||||
bogus-priv
|
||||
<% end -%>
|
||||
<% if @cache_size -%>
|
||||
cache-size=<%= @cache_size %>
|
||||
<% end -%>
|
||||
<% @servers.each do |server| -%>
|
||||
server=<%= server %>
|
||||
<% end -%>
|
||||
<% @forwards.keys.sort.each do |domain| -%>
|
||||
<% @forwards[domain].each do |server| -%>
|
||||
server=/<%= domain %>/<%= server %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% @dhcp_relays.each do |relay| -%>
|
||||
dhcp-relay=<%= relay %>
|
||||
<% end -%>
|
||||
<% @options.each do |line| -%>
|
||||
<%= line %>
|
||||
<% end -%>
|
||||
@@ -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,
|
||||
|
||||
@@ -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 -%>
|
||||
|
||||
@@ -3,13 +3,21 @@
|
||||
require 'facter'
|
||||
require 'yaml'
|
||||
require 'net/http'
|
||||
require 'openssl'
|
||||
require 'uri'
|
||||
require 'fileutils'
|
||||
|
||||
# CobblerENC module: Fetches ENC data from Cobbler, caches it, and provides structured facts.
|
||||
module CobblerENC
|
||||
# EncapiENC module: Fetches ENC data from encapi, caches it, and provides structured facts.
|
||||
module EncapiENC
|
||||
CACHE_FILE = '/var/cache/puppet_enc.yaml'
|
||||
CACHE_TTL = 7 * 24 * 60 * 60 # 7 days in seconds
|
||||
# Facter runs under Puppet's vendored ruby, whose OpenSSL trusts only
|
||||
# /opt/puppetlabs/puppet/ssl/cert.pem and never the system trust store, so the
|
||||
# estate CA anchor profiles::pki::vaultca installs has to be named explicitly.
|
||||
CA_BUNDLE_PATHS = [
|
||||
'/etc/pki/ca-trust/source/anchors/vaultcaroot.pem',
|
||||
'/usr/local/share/ca-certificates/vaultcaroot.pem'
|
||||
].freeze
|
||||
@enc_data = nil # In-memory cache for the ENC response
|
||||
|
||||
def self.read_cache
|
||||
@@ -29,9 +37,22 @@ module CobblerENC
|
||||
File.write(CACHE_FILE, cache_data.to_yaml)
|
||||
end
|
||||
|
||||
def self.fetch_from_cobbler
|
||||
uri = URI("http://cobbler.main.unkin.net/cblr/svc/op/puppet/hostname/#{Facter.value(:fqdn) || Facter.value(:hostname)}")
|
||||
response = Net::HTTP.get_response(uri)
|
||||
def self.ca_bundle
|
||||
CA_BUNDLE_PATHS.find { |path| File.exist?(path) }
|
||||
end
|
||||
|
||||
def self.http_client(uri)
|
||||
client = Net::HTTP.new(uri.host, uri.port)
|
||||
client.use_ssl = true
|
||||
client.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
||||
bundle = ca_bundle
|
||||
client.ca_file = bundle if bundle
|
||||
client
|
||||
end
|
||||
|
||||
def self.fetch_from_encapi
|
||||
uri = URI("https://encapi.k8s.syd1.au.unkin.net/cblr/svc/op/puppet/hostname/#{Facter.value(:fqdn) || Facter.value(:hostname)}")
|
||||
response = http_client(uri).request(Net::HTTP::Get.new(uri))
|
||||
|
||||
raise "Failed to fetch ENC data. HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
|
||||
|
||||
@@ -41,7 +62,7 @@ module CobblerENC
|
||||
def self.retrieve_enc_data
|
||||
return @enc_data if @enc_data
|
||||
|
||||
@enc_data = fetch_from_cobbler
|
||||
@enc_data = fetch_from_encapi
|
||||
write_cache(@enc_data)
|
||||
@enc_data
|
||||
end
|
||||
@@ -49,26 +70,26 @@ module CobblerENC
|
||||
def self.fetch_enc_data
|
||||
retrieve_enc_data
|
||||
rescue StandardError => e
|
||||
Facter.warn("Error retrieving Cobbler ENC data: #{e.message}")
|
||||
Facter.warn("Error retrieving encapi ENC data: #{e.message}")
|
||||
@enc_data = read_cache
|
||||
return @enc_data unless @enc_data.empty?
|
||||
|
||||
raise 'No cached ENC data available and Cobbler is down.'
|
||||
raise 'No cached ENC data available and encapi is unreachable.'
|
||||
end
|
||||
|
||||
def self.enc_role
|
||||
fetch_enc_data.fetch('classes', {}).keys.first || raise('ENC Role not found in Cobbler ENC response')
|
||||
fetch_enc_data.fetch('classes', {}).keys.first || raise('ENC Role not found in encapi ENC response')
|
||||
end
|
||||
|
||||
def self.enc_env
|
||||
fetch_enc_data.fetch('environment', nil) || raise('ENC Environment not found in Cobbler ENC response')
|
||||
fetch_enc_data.fetch('environment', nil) || raise('ENC Environment not found in encapi ENC response')
|
||||
end
|
||||
end
|
||||
|
||||
Facter.add('enc_role') do
|
||||
setcode { CobblerENC.enc_role }
|
||||
setcode { EncapiENC.enc_role }
|
||||
end
|
||||
|
||||
Facter.add('enc_env') do
|
||||
setcode { CobblerENC.enc_env }
|
||||
setcode { EncapiENC.enc_env }
|
||||
end
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'facter'
|
||||
require 'json'
|
||||
|
||||
# Exposes LLDP neighbour topology (switch/port each interface is cabled to) as
|
||||
# the structured `lldp` fact, keyed by local interface. This is the only source
|
||||
# of physical switch/port topology in the estate and feeds NetBox. Uses
|
||||
# `lldpctl -f json0`: json0 wraps every node in an array regardless of
|
||||
# cardinality, so one neighbour and many neighbours parse identically (plain
|
||||
# `keyvalue` folds the neighbour's sysname into the key path, and plain `json`
|
||||
# collapses single-element arrays into objects). Never raises: any error or a
|
||||
# down daemon yields an empty hash so a puppet run can never break.
|
||||
module LldpFact
|
||||
SOCKETS = ['/run/lldpd.socket', '/var/run/lldpd.socket'].freeze
|
||||
|
||||
module_function
|
||||
|
||||
# First element of a json0 node (everything is array-wrapped), or the value
|
||||
# itself if it is not an array; nil when absent.
|
||||
def first(node)
|
||||
node.is_a?(Array) ? node[0] : node
|
||||
end
|
||||
|
||||
# Array form of a json0 node whatever its cardinality.
|
||||
def list(node)
|
||||
node.is_a?(Array) ? node : [node].compact
|
||||
end
|
||||
|
||||
# Value string of a json0 leaf like [{ 'value' => 'x' }].
|
||||
def leaf(node)
|
||||
entry = first(node)
|
||||
entry.is_a?(Hash) ? entry['value'] : entry
|
||||
end
|
||||
|
||||
# Chassis MAC from its id list, preferring the entry typed 'mac'.
|
||||
def chassis_mac(chassis)
|
||||
ids = list(chassis['id'])
|
||||
mac = ids.find { |id| id.is_a?(Hash) && id['type'] == 'mac' } || ids.first
|
||||
mac.is_a?(Hash) ? mac['value'] : nil
|
||||
end
|
||||
|
||||
# Topology record for one local interface, or nil when it has no neighbour.
|
||||
def neighbour(iface)
|
||||
chassis = first(iface['chassis'])
|
||||
port = first(iface['port'])
|
||||
return nil unless chassis && port
|
||||
|
||||
chassis_fields(chassis).merge(port_fields(port, first(iface['vlan'])))
|
||||
end
|
||||
|
||||
def chassis_fields(chassis)
|
||||
{
|
||||
'neighbor_chassis_name' => leaf(chassis['name']),
|
||||
'neighbor_chassis_mac' => chassis_mac(chassis),
|
||||
'neighbor_chassis_descr' => leaf(chassis['descr'])
|
||||
}
|
||||
end
|
||||
|
||||
def port_fields(port, vlan)
|
||||
port_id = first(port['id'])
|
||||
vlan_h = vlan.is_a?(Hash) ? vlan : {}
|
||||
{
|
||||
'neighbor_port_id' => port_id.is_a?(Hash) ? port_id['value'] : port_id,
|
||||
'neighbor_port_descr' => leaf(port['descr']),
|
||||
'vlan_id' => vlan_h['vlan-id'],
|
||||
'vlan_name' => vlan_h['value']
|
||||
}
|
||||
end
|
||||
|
||||
def interfaces(output)
|
||||
lldp = first(JSON.parse(output)['lldp']) || {}
|
||||
list(lldp['interface'])
|
||||
end
|
||||
|
||||
# Map of local interface => topology record, skipping interfaces with no
|
||||
# neighbour.
|
||||
def collect(ifaces)
|
||||
ifaces.each_with_object({}) do |iface, acc|
|
||||
next unless iface.is_a?(Hash)
|
||||
|
||||
name = iface['name']
|
||||
data = neighbour(iface)
|
||||
acc[name] = data if name && data
|
||||
end
|
||||
end
|
||||
|
||||
def resolve
|
||||
output = Facter::Core::Execution.execute('lldpctl -f json0 2>/dev/null', on_fail: nil)
|
||||
return {} if output.to_s.empty?
|
||||
|
||||
collect(interfaces(output))
|
||||
rescue StandardError
|
||||
{}
|
||||
end
|
||||
end
|
||||
|
||||
Facter.add(:lldp) do
|
||||
confine kernel: 'Linux'
|
||||
confine { Facter.value(:is_virtual) == false }
|
||||
confine { Facter::Core::Execution.which('lldpctl') }
|
||||
confine { LldpFact::SOCKETS.any? { |path| File.exist?(path) } }
|
||||
setcode { LldpFact.resolve }
|
||||
end
|
||||
@@ -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
|
||||
@@ -5,6 +5,7 @@ require 'ipaddr'
|
||||
# a class that creates facts based on the subnet
|
||||
class SubnetAttributes
|
||||
SUBNET_TO_ATTRIBUTES = {
|
||||
'198.18.2.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' }, # router loopbacks
|
||||
'198.18.13.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' },
|
||||
'198.18.14.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' },
|
||||
'198.18.15.0/24' => { environment: 'prod', region: 'syd1', country: 'au', zone: 'common' },
|
||||
@@ -21,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))
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
DEFAULT_ATTRIBUTES
|
||||
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] } }
|
||||
|
||||
@@ -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)"
|
||||
@@ -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
|
||||
|
||||
@@ -6,10 +6,17 @@ class rke2::install (
|
||||
Stdlib::HTTPUrl $container_archive_source = $rke2::container_archive_source,
|
||||
){
|
||||
|
||||
# versionlock rke2
|
||||
# versionlock rke2 before install so the lock exists before any upgrade is attempted
|
||||
yum::versionlock{"rke2-${node_type}":
|
||||
ensure => present,
|
||||
version => "${rke2_version}~${rke2_release}",
|
||||
before => Package["rke2-${node_type}"],
|
||||
}
|
||||
|
||||
# lock rke2-common (a strict = version dep) so the rolling latest channel can't drift it ahead of the pinned server/agent
|
||||
yum::versionlock{'rke2-common':
|
||||
ensure => present,
|
||||
version => "${rke2_version}~${rke2_release}",
|
||||
}
|
||||
|
||||
# install rke2
|
||||
@@ -27,10 +34,10 @@ class rke2::install (
|
||||
before => Service["rke2-${node_type}"],
|
||||
}
|
||||
|
||||
# download required archive of containers
|
||||
# preload the airgap bundle (has the default canal CNI images) so canal starts from disk, not the mirror VIP that needs flannel first
|
||||
archive { '/var/lib/rancher/rke2/agent/images/rke2-images.linux-amd64.tar.zst':
|
||||
ensure => present,
|
||||
source => "https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/github/rancher/rke2/releases/download/v${rke2_version}%2B${rke2_release}/rke2-images.linux-amd64.tar.zst",
|
||||
source => "${container_archive_source}/v${rke2_version}%2B${rke2_release}/rke2-images.linux-amd64.tar.zst",
|
||||
require => [
|
||||
Package["rke2-${node_type}"],
|
||||
File['/var/lib/rancher/rke2/agent/images'],
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# rke2 params
|
||||
class rke2::params (
|
||||
Enum['server', 'agent'] $node_type = 'agent',
|
||||
String $rke2_version = '1.33.4',
|
||||
String $rke2_release = 'rke2r1',
|
||||
String $rke2_version = '1.33.13',
|
||||
String $rke2_release = 'rke2r2',
|
||||
Stdlib::Absolutepath $config_file = '/etc/rancher/rke2/config.yaml',
|
||||
Hash $config_hash = {},
|
||||
Stdlib::HTTPSUrl $join_url = 'https://127.0.0.1:9345',
|
||||
|
||||
@@ -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',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# manage wireguard interfaces via wg-quick
|
||||
class wireguard (
|
||||
Boolean $manage_package = true,
|
||||
String $package_name = 'wireguard-tools',
|
||||
Variant[Hash, Sensitive[Hash]] $interfaces = {},
|
||||
) {
|
||||
|
||||
if $manage_package {
|
||||
package { $package_name:
|
||||
ensure => installed,
|
||||
before => File['/etc/wireguard'],
|
||||
}
|
||||
}
|
||||
|
||||
file { '/etc/wireguard':
|
||||
ensure => directory,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0700',
|
||||
}
|
||||
|
||||
# hiera hands eyaml secrets over as plain strings inside the (Sensitive) hash; re-wrap them per resource
|
||||
$raw = $interfaces ? {
|
||||
Sensitive => $interfaces.unwrap,
|
||||
default => $interfaces,
|
||||
}
|
||||
|
||||
$raw.each |String $iface, Hash $data| {
|
||||
$peers = $data.get('peers', []).map |Hash $peer| {
|
||||
$peer['preshared_key'] =~ String ? {
|
||||
true => $peer + { 'preshared_key' => Sensitive($peer['preshared_key']) },
|
||||
default => $peer,
|
||||
}
|
||||
}
|
||||
$private_key = $data['private_key'] =~ String ? {
|
||||
true => Sensitive($data['private_key']),
|
||||
default => $data['private_key'],
|
||||
}
|
||||
|
||||
wireguard::interface { $iface:
|
||||
* => $data + { 'peers' => $peers, 'private_key' => $private_key },
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
# manage one wg-quick interface; without private_key, /etc/wireguard/<iface>.key is generated once and loaded via PostUp
|
||||
define wireguard::interface (
|
||||
Array[Stdlib::IP::Address] $addresses,
|
||||
Optional[Stdlib::Port] $listen_port = undef,
|
||||
Optional[Integer[1280, 9000]] $mtu = undef,
|
||||
Optional[Sensitive[String[1]]] $private_key = undef,
|
||||
Array[Struct[{
|
||||
public_key => String[1],
|
||||
allowed_ips => Variant[String[1], Array[String[1], 1]],
|
||||
preshared_key => Optional[Sensitive[String[1]]],
|
||||
endpoint => Optional[String[1]],
|
||||
persistent_keepalive => Optional[Integer[0, 65535]],
|
||||
}]] $peers = [],
|
||||
) {
|
||||
|
||||
$conf = "/etc/wireguard/${name}.conf"
|
||||
$key = $private_key.then |$k| { $k.unwrap }
|
||||
|
||||
if $private_key =~ Undef {
|
||||
$keyfile = "/etc/wireguard/${name}.key"
|
||||
|
||||
exec { "wireguard_genkey_${name}":
|
||||
command => "/bin/sh -c 'umask 077; wg genkey > ${keyfile}'",
|
||||
creates => $keyfile,
|
||||
path => ['/usr/bin', '/usr/sbin', '/bin', '/sbin'],
|
||||
require => File['/etc/wireguard'],
|
||||
}
|
||||
|
||||
file { $keyfile:
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0600',
|
||||
require => Exec["wireguard_genkey_${name}"],
|
||||
before => [File[$conf], Service["wg-quick@${name}"]],
|
||||
}
|
||||
}
|
||||
|
||||
file { $conf:
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0600',
|
||||
content => Sensitive(template('wireguard/wg.conf.erb')),
|
||||
show_diff => false,
|
||||
notify => Exec["wireguard_syncconf_${name}"],
|
||||
}
|
||||
|
||||
service { "wg-quick@${name}":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => File[$conf],
|
||||
}
|
||||
|
||||
# syncconf applies peer/key changes without bouncing the tunnel; address/mtu changes need a manual restart
|
||||
exec { "wireguard_syncconf_${name}":
|
||||
command => "/bin/bash -c 'wg syncconf ${name} <(wg-quick strip ${name})'",
|
||||
onlyif => "/usr/sbin/ip link show ${name}",
|
||||
path => ['/usr/bin', '/usr/sbin', '/bin', '/sbin'],
|
||||
refreshonly => true,
|
||||
require => Service["wg-quick@${name}"],
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
# THIS FILE IS MANAGED BY PUPPET
|
||||
[Interface]
|
||||
<% @addresses.each do |addr| -%>
|
||||
Address = <%= addr %>
|
||||
<% end -%>
|
||||
<% if @listen_port -%>
|
||||
ListenPort = <%= @listen_port %>
|
||||
<% end -%>
|
||||
<% if @mtu -%>
|
||||
MTU = <%= @mtu %>
|
||||
<% end -%>
|
||||
<% if @key -%>
|
||||
PrivateKey = <%= @key %>
|
||||
<% else -%>
|
||||
PostUp = wg set %i private-key /etc/wireguard/%i.key
|
||||
<% end -%>
|
||||
<% @peers.each do |peer| -%>
|
||||
|
||||
[Peer]
|
||||
PublicKey = <%= peer['public_key'] %>
|
||||
<% if peer['preshared_key'] -%>
|
||||
PresharedKey = <%= peer['preshared_key'].unwrap %>
|
||||
<% end -%>
|
||||
AllowedIPs = <%= Array(peer['allowed_ips']).join(', ') %>
|
||||
<% if peer['endpoint'] -%>
|
||||
Endpoint = <%= peer['endpoint'] %>
|
||||
<% end -%>
|
||||
<% if peer['persistent_keepalive'] -%>
|
||||
PersistentKeepalive = <%= peer['persistent_keepalive'] %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB |
@@ -2,6 +2,9 @@
|
||||
class profiles::ceph::client (
|
||||
String $fsid,
|
||||
Array[Stdlib::Host] $mons,
|
||||
# cluster topology (single source of truth: hieradata/common.yaml)
|
||||
Array[Stdlib::Host] $cluster_public_ips,
|
||||
Array[Stdlib::Host] $mon_initial_members,
|
||||
Stdlib::Absolutepath $config_file = '/etc/ceph/ceph.conf',
|
||||
Boolean $manage_ceph_conf = true,
|
||||
Boolean $manage_ceph_package = true,
|
||||
@@ -10,6 +13,24 @@ class profiles::ceph::client (
|
||||
String $group = 'ceph',
|
||||
Stdlib::Filemode $mode = '0644',
|
||||
Hash $keyrings = {},
|
||||
# [global] tunables (defaults match the live hand-maintained ceph.conf)
|
||||
String $auth_client_required = 'cephx',
|
||||
String $auth_cluster_required = 'cephx',
|
||||
String $auth_service_required = 'cephx',
|
||||
Boolean $mon_allow_pool_delete = true,
|
||||
Boolean $ms_bind_ipv4 = true,
|
||||
Boolean $ms_bind_ipv6 = false,
|
||||
Integer $osd_crush_chooseleaf_type = 1,
|
||||
Integer $osd_pool_default_min_size = 2,
|
||||
Integer $osd_pool_default_size = 3,
|
||||
Integer $osd_pool_default_pg_num = 128,
|
||||
# mds config sections; only rendered on mon/mgr/mds hosts (render_mds_config)
|
||||
Boolean $render_mds_config = false,
|
||||
Hash[String, Integer] $mds_instances = {},
|
||||
Hash $mds_common = {
|
||||
'keyring' => '/var/lib/ceph/mds/ceph-$id/keyring',
|
||||
'mds_standby_replay' => true,
|
||||
},
|
||||
) {
|
||||
|
||||
# dont run this on proxmox nodes
|
||||
@@ -22,6 +43,13 @@ class profiles::ceph::client (
|
||||
}
|
||||
}
|
||||
|
||||
# only depend on the package when this class manages it; on the ceph
|
||||
# hosts the package is delivered by cephadm / profiles::packages instead.
|
||||
$config_require = $manage_ceph_package ? {
|
||||
true => Package['ceph-common'],
|
||||
default => undef,
|
||||
}
|
||||
|
||||
# manage the ceph directory
|
||||
if $manage_ceph_paths {
|
||||
file { '/etc/ceph':
|
||||
@@ -29,11 +57,11 @@ class profiles::ceph::client (
|
||||
owner => $owner,
|
||||
group => $group,
|
||||
mode => $mode,
|
||||
require => Package['ceph-common'],
|
||||
require => $config_require,
|
||||
}
|
||||
}
|
||||
|
||||
# create a basic client config
|
||||
# render /etc/ceph/ceph.conf from cluster topology in hiera
|
||||
if $manage_ceph_conf {
|
||||
file { $config_file:
|
||||
ensure => file,
|
||||
@@ -41,7 +69,7 @@ class profiles::ceph::client (
|
||||
group => $group,
|
||||
mode => $mode,
|
||||
content => template('profiles/ceph/client.conf.erb'),
|
||||
require => Package['ceph-common'],
|
||||
require => $config_require,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ class profiles::ceph::osd (
|
||||
Boolean $ensure_running = true,
|
||||
) {
|
||||
|
||||
# tune the I/O scheduler on the disks backing ceph OSDs
|
||||
include profiles::ceph::osd_scheduler
|
||||
|
||||
if $ensure_running and $facts['is_ceph_osd'] {
|
||||
$facts['ceph_services']['osd'].each |String $svc| {
|
||||
service { $svc:
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
class profiles::ceph::osd_scheduler (
|
||||
String[1] $scheduler = 'none',
|
||||
) {
|
||||
|
||||
$devices = $facts['ceph_osd_devices']
|
||||
|
||||
# no-op where the fact is absent/empty (VMs, non-OSD hosts have no ceph PVs)
|
||||
if $devices =~ Array[String[1], 1] {
|
||||
|
||||
# strip /dev/ so the rule matches the udev KERNEL sysname (e.g. sda)
|
||||
$kernel_names = $devices.map |$dev| { regsubst($dev, '^.*/', '') }
|
||||
$sysname_matches = $kernel_names.map |$name| { "--sysname-match=${name}" }
|
||||
|
||||
file { '/etc/udev/rules.d/60-ceph-osd-scheduler.rules':
|
||||
ensure => file,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
content => template('profiles/ceph/osd-scheduler.rules.erb'),
|
||||
notify => Exec['ceph-osd-scheduler-reload'],
|
||||
}
|
||||
|
||||
# apply immediately; udev re-applies on reboot and device re-add
|
||||
$trigger = "udevadm trigger --subsystem-match=block --action=change ${join($sysname_matches, ' ')}"
|
||||
|
||||
exec { 'ceph-osd-scheduler-reload':
|
||||
command => "udevadm control --reload-rules && ${trigger}",
|
||||
path => ['/usr/bin', '/bin', '/usr/sbin', '/sbin'],
|
||||
refreshonly => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -24,8 +24,7 @@ class profiles::dns::updater (
|
||||
Stdlib::AbsolutePath $config_dir = '/etc/dns-updater',
|
||||
Stdlib::AbsolutePath $master_basedir = lookup('profiles::dns::master::basedir'),
|
||||
# dns-updater daemon (replaces the dns-update shell script). 'latest' so hosts
|
||||
# pick up new releases (e.g. the record filter); rpm-internal metadata_expire
|
||||
# is 1h so this does not thrash.
|
||||
# pick up new releases (e.g. the record filter).
|
||||
String $package_ensure = 'latest',
|
||||
Stdlib::AbsolutePath $api_socket = '/run/dns-updater/api.sock',
|
||||
String $resync = '10m',
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,27 +1,15 @@
|
||||
# profiles::helpers::certmanager
|
||||
#
|
||||
# wrapper class for python, pip and venv
|
||||
# renders the config.yaml read by the certmanager binary (RPM-installed)
|
||||
class profiles::helpers::certmanager (
|
||||
String $script_name = 'certmanager',
|
||||
Stdlib::AbsolutePath $base_path = "/opt/${script_name}",
|
||||
Stdlib::AbsolutePath $venv_path = "${base_path}/venv",
|
||||
Stdlib::AbsolutePath $config_path = "${base_path}/config.yaml",
|
||||
Hash $vault_config = {},
|
||||
String $owner = 'root',
|
||||
String $group = 'root',
|
||||
Boolean $systempkgs = false,
|
||||
String $version = 'system',
|
||||
Array[String[1]] $packages = ['requests', 'pyyaml'],
|
||||
){
|
||||
|
||||
if $::facts['python3_version'] {
|
||||
|
||||
$python_version = $version ? {
|
||||
'system' => $::facts['python3_version'],
|
||||
default => $version,
|
||||
}
|
||||
|
||||
# ensure the base_path exists
|
||||
file { $base_path:
|
||||
ensure => directory,
|
||||
mode => '0755',
|
||||
@@ -29,49 +17,12 @@ class profiles::helpers::certmanager (
|
||||
group => $group,
|
||||
}
|
||||
|
||||
# create a venv
|
||||
python::pyvenv { $venv_path :
|
||||
ensure => present,
|
||||
version => $python_version,
|
||||
systempkgs => $systempkgs,
|
||||
venv_dir => $venv_path,
|
||||
owner => $owner,
|
||||
group => $group,
|
||||
require => File[$base_path],
|
||||
}
|
||||
|
||||
# install the required pip packages
|
||||
$packages.each |String $package| {
|
||||
python::pip { "${venv_path}_${package}":
|
||||
ensure => present,
|
||||
pkgname => $package,
|
||||
virtualenv => $venv_path,
|
||||
}
|
||||
}
|
||||
|
||||
# create the script from a template
|
||||
file { "${base_path}/${script_name}":
|
||||
ensure => file,
|
||||
mode => '0755',
|
||||
content => template("profiles/helpers/${script_name}.erb"),
|
||||
require => Python::Pyvenv[$venv_path],
|
||||
}
|
||||
|
||||
# create the config from a template
|
||||
file { $config_path:
|
||||
ensure => file,
|
||||
mode => '0660',
|
||||
owner => 'puppet',
|
||||
group => 'root',
|
||||
content => Sensitive(template("profiles/helpers/${script_name}_config.yaml.erb")),
|
||||
require => Python::Pyvenv[$venv_path],
|
||||
}
|
||||
|
||||
# create symbolic link in $PATH
|
||||
file { "/usr/local/bin/${script_name}":
|
||||
ensure => 'link',
|
||||
target => "${base_path}/${script_name}",
|
||||
require => File["${base_path}/${script_name}"],
|
||||
}
|
||||
require => File[$base_path],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,15 @@
|
||||
# profiles::helpers::sshsignhost
|
||||
#
|
||||
# wrapper class for python, pip and venv
|
||||
# renders the config.yaml read by the sshsignhost binary (RPM-installed)
|
||||
class profiles::helpers::sshsignhost (
|
||||
String $script_name = 'sshsignhost',
|
||||
Stdlib::AbsolutePath $base_path = "/opt/${script_name}",
|
||||
Stdlib::AbsolutePath $venv_path = "${base_path}/venv",
|
||||
Stdlib::AbsolutePath $config_path = "${base_path}/config.yaml",
|
||||
Hash $vault_config = {},
|
||||
String $owner = 'root',
|
||||
String $group = 'root',
|
||||
Boolean $systempkgs = false,
|
||||
String $version = 'system',
|
||||
Array[String[1]] $packages = ['requests', 'pyyaml'],
|
||||
){
|
||||
|
||||
if $::facts['python3_version'] {
|
||||
|
||||
$python_version = $version ? {
|
||||
'system' => $::facts['python3_version'],
|
||||
default => $version,
|
||||
}
|
||||
|
||||
# ensure the base_path exists
|
||||
file { $base_path:
|
||||
ensure => directory,
|
||||
mode => '0755',
|
||||
@@ -29,49 +17,12 @@ class profiles::helpers::sshsignhost (
|
||||
group => $group,
|
||||
}
|
||||
|
||||
# create a venv
|
||||
python::pyvenv { $venv_path :
|
||||
ensure => present,
|
||||
version => $python_version,
|
||||
systempkgs => $systempkgs,
|
||||
venv_dir => $venv_path,
|
||||
owner => $owner,
|
||||
group => $group,
|
||||
require => File[$base_path],
|
||||
}
|
||||
|
||||
# install the required pip packages
|
||||
$packages.each |String $package| {
|
||||
python::pip { "${venv_path}_${package}":
|
||||
ensure => present,
|
||||
pkgname => $package,
|
||||
virtualenv => $venv_path,
|
||||
}
|
||||
}
|
||||
|
||||
# create the script from a template
|
||||
file { "${base_path}/${script_name}":
|
||||
ensure => file,
|
||||
mode => '0755',
|
||||
content => template("profiles/helpers/${script_name}.erb"),
|
||||
require => Python::Pyvenv[$venv_path],
|
||||
}
|
||||
|
||||
# create the config from a template
|
||||
file { $config_path:
|
||||
ensure => file,
|
||||
mode => '0660',
|
||||
owner => 'puppet',
|
||||
group => 'root',
|
||||
content => Sensitive(template("profiles/helpers/${script_name}_config.yaml.erb")),
|
||||
require => Python::Pyvenv[$venv_path],
|
||||
}
|
||||
|
||||
# create symbolic link in $PATH
|
||||
file { "/usr/local/bin/${script_name}":
|
||||
ensure => 'link',
|
||||
target => "${base_path}/${script_name}",
|
||||
require => File["${base_path}/${script_name}"],
|
||||
}
|
||||
require => File[$base_path],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# profiles::lldpd
|
||||
#
|
||||
# Runs lldpd on physical hosts so each machine learns its switch/port topology
|
||||
# via LLDP. The `lldp` fact exposes that neighbour data for NetBox. Assigned
|
||||
# via hiera_include from hieradata/virtual/physical.yaml (physicals only); the
|
||||
# lldpd.service ships disabled, so it is explicitly enabled and started here.
|
||||
class profiles::lldpd (
|
||||
Boolean $enabled = true,
|
||||
String $package = 'lldpd',
|
||||
String $service = 'lldpd',
|
||||
){
|
||||
|
||||
if $enabled {
|
||||
package { $package:
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
service { $service:
|
||||
ensure => running,
|
||||
enable => true,
|
||||
subscribe => Package[$package],
|
||||
}
|
||||
} else {
|
||||
service { $service:
|
||||
ensure => stopped,
|
||||
enable => false,
|
||||
}
|
||||
|
||||
package { $package:
|
||||
ensure => absent,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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']],
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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' => {
|
||||
|
||||
@@ -2,19 +2,14 @@
|
||||
# This class manages Puppet agent package and service.
|
||||
class profiles::puppet::agent (
|
||||
String $version = 'latest',
|
||||
Boolean $openvox_enable = false,
|
||||
) {
|
||||
|
||||
# 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,13 +43,14 @@ 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
|
||||
# versionlock puppet-agent before install so the lock exists before any upgrade is attempted
|
||||
yum::versionlock{$use_package:
|
||||
ensure => $agent_versionlock_ensure,
|
||||
version => $agent_versionlock_version,
|
||||
before => Package[$use_package],
|
||||
}
|
||||
}
|
||||
'Debian': {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# Class: profiles::puppet::encapic
|
||||
#
|
||||
# Manages the configuration for the encapic ENC client. The package itself is
|
||||
# installed through profiles::packages (pinned in hiera); this class owns the
|
||||
# config so the encapi endpoint can change without repackaging.
|
||||
class profiles::puppet::encapic (
|
||||
Stdlib::HTTPUrl $encapi_url,
|
||||
Stdlib::AbsolutePath $config_dir = '/etc/encapi',
|
||||
String $config_name = 'encapic.conf',
|
||||
String $owner = 'root',
|
||||
String $group = 'root',
|
||||
) {
|
||||
|
||||
# order after the package so the shim exists before the config does.
|
||||
file { $config_dir:
|
||||
ensure => directory,
|
||||
mode => '0755',
|
||||
owner => $owner,
|
||||
group => $group,
|
||||
require => Package['encapic'],
|
||||
}
|
||||
|
||||
file { "${config_dir}/${config_name}":
|
||||
ensure => file,
|
||||
mode => '0644',
|
||||
owner => $owner,
|
||||
group => $group,
|
||||
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'],
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -12,6 +12,7 @@ class profiles::puppet::puppetmaster (
|
||||
include profiles::puppet::g10k
|
||||
include profiles::puppet::enc
|
||||
include profiles::puppet::cobbler_enc
|
||||
include profiles::puppet::encapic
|
||||
include profiles::puppet::autosign
|
||||
include profiles::puppet::gems
|
||||
include profiles::helpers::certmanager
|
||||
|
||||
@@ -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'],
|
||||
}
|
||||
}
|
||||
@@ -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],
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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'],
|
||||
}
|
||||
}
|
||||
@@ -122,15 +122,6 @@ class profiles::vault::server (
|
||||
]
|
||||
}
|
||||
|
||||
# go-plugin creates each secrets plugin's control socket as /tmp/pluginNNN;
|
||||
# systemd-tmpfiles-clean reaps files aged past the /tmp policy, severing the
|
||||
# socket of a long-lived plugin and orphaning the still-running process
|
||||
# (every request then fails: rpc Unavailable, dial unix /tmp/pluginNNN: no
|
||||
# such file). Exclude the sockets from cleaning for all plugins.
|
||||
systemd::tmpfile { 'openbao-plugin-sockets.conf':
|
||||
content => "x /tmp/plugin*\n",
|
||||
}
|
||||
|
||||
# ensure the vault audit log exists
|
||||
file { $audit_log:
|
||||
ensure => 'file',
|
||||
@@ -139,6 +130,20 @@ class profiles::vault::server (
|
||||
mode => '0600',
|
||||
}
|
||||
|
||||
# go-plugin creates each secrets plugin's control socket under TMPDIR
|
||||
# (/tmp/pluginNNN by default); systemd-tmpfiles-clean reaps aged /tmp files
|
||||
# and severs the socket of a long-lived plugin, orphaning the process. Point
|
||||
# TMPDIR at a per-start RuntimeDirectory on /run (tmpfs, no age cleanup).
|
||||
systemd::manage_dropin { 'plugin-tmpdir.conf':
|
||||
unit => 'vault.service',
|
||||
service_entry => {
|
||||
'RuntimeDirectory' => 'vault-plugins',
|
||||
'RuntimeDirectoryMode' => '0700',
|
||||
'Environment' => 'TMPDIR=/run/vault-plugins',
|
||||
},
|
||||
notify => Service['vault'],
|
||||
}
|
||||
|
||||
service { 'vault':
|
||||
ensure => true,
|
||||
enable => true,
|
||||
|
||||
@@ -1,3 +1,28 @@
|
||||
[global]
|
||||
auth_client_required = <%= @auth_client_required %>
|
||||
auth_cluster_required = <%= @auth_cluster_required %>
|
||||
auth_service_required = <%= @auth_service_required %>
|
||||
fsid = <%= @fsid %>
|
||||
mon_host = <%= @mons.join(' ') %>
|
||||
mon_allow_pool_delete = <%= @mon_allow_pool_delete %>
|
||||
mon_initial_members = <%= @mon_initial_members.join(',') %>
|
||||
mon_host = <%= @mons.join(',') %>
|
||||
ms_bind_ipv4 = <%= @ms_bind_ipv4 %>
|
||||
ms_bind_ipv6 = <%= @ms_bind_ipv6 %>
|
||||
osd_crush_chooseleaf_type = <%= @osd_crush_chooseleaf_type %>
|
||||
osd_pool_default_min_size = <%= @osd_pool_default_min_size %>
|
||||
osd_pool_default_size = <%= @osd_pool_default_size %>
|
||||
osd_pool_default_pg_num = <%= @osd_pool_default_pg_num %>
|
||||
public_network = <%= @cluster_public_ips.map { |ip| "#{ip}/32" }.join(',') %>
|
||||
<% if @render_mds_config -%>
|
||||
|
||||
[mds]
|
||||
keyring = <%= @mds_common['keyring'] %>
|
||||
mds_standby_replay = <%= @mds_common['mds_standby_replay'] %>
|
||||
<% @mds_instances.sort.each do |host, count| -%>
|
||||
<% (1..count).each do |instance| -%>
|
||||
|
||||
[mds.<%= host %>-<%= instance %>]
|
||||
host = <%= host %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# Managed by puppet (profiles::ceph::osd_scheduler).
|
||||
# Set the I/O scheduler to <%= @scheduler %> on ceph OSD block devices.
|
||||
<% @kernel_names.sort.each do |dev| -%>
|
||||
ACTION=="add|change", SUBSYSTEM=="block", KERNEL=="<%= dev %>", ATTR{queue/scheduler}="<%= @scheduler %>"
|
||||
<% end -%>
|
||||
@@ -1,102 +0,0 @@
|
||||
#!<%= @venv_path %>/bin/python
|
||||
|
||||
import argparse
|
||||
import requests
|
||||
import json
|
||||
import os
|
||||
import yaml
|
||||
from zipfile import ZipFile
|
||||
|
||||
# remove this after certs are generated everywhere
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
def load_config(config_path):
|
||||
with open(config_path, 'r') as file:
|
||||
config = yaml.safe_load(file)
|
||||
return config['vault']
|
||||
|
||||
def authenticate_approle(vault_config):
|
||||
url = f"{vault_config['addr']}/v1/auth/{vault_config['approle_path']}/login"
|
||||
payload = {
|
||||
"role_id": vault_config['role_id'],
|
||||
}
|
||||
response = requests.post(url, json=payload, verify=False)
|
||||
if response.status_code == 200:
|
||||
auth_response = response.json()
|
||||
return auth_response['auth']['client_token']
|
||||
else:
|
||||
print(f"Error authenticating with AppRole: {response.text}")
|
||||
return None
|
||||
|
||||
def request_certificate(common_name, alt_names, ip_sans, expiry_days, vault_config):
|
||||
# Authenticate using AppRole and get a token
|
||||
client_token = authenticate_approle(vault_config)
|
||||
if not client_token:
|
||||
print("Failed to authenticate with Vault using AppRole.")
|
||||
return None
|
||||
|
||||
url = f"{vault_config['addr']}/v1/{vault_config['mount_point']}/issue/{vault_config['role_name']}"
|
||||
headers = {'X-Vault-Token': client_token}
|
||||
payload = {
|
||||
"common_name": common_name,
|
||||
"alt_names": ",".join(alt_names),
|
||||
"ip_sans": ",".join(ip_sans),
|
||||
"ttl": f"{expiry_days}d"
|
||||
}
|
||||
response = requests.post(url, headers=headers, json=payload, verify=False)
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
else:
|
||||
print(f"Error requesting certificate: {response.text}")
|
||||
return None
|
||||
|
||||
def save_cert_files(certificate_response, common_name, compress, config, json_output):
|
||||
base_path = config.get('output_path', '.')
|
||||
cert_dir = os.path.join(base_path, common_name)
|
||||
if json_output:
|
||||
import json
|
||||
output = {
|
||||
'certificate': certificate_response['data']['certificate'],
|
||||
'private_key': certificate_response['data']['private_key'],
|
||||
'full_chain': certificate_response['data']['issuing_ca'] + "\n" + certificate_response['data']['certificate'],
|
||||
}
|
||||
print(json.dumps(output))
|
||||
elif not compress:
|
||||
os.makedirs(cert_dir, exist_ok=True)
|
||||
with open(os.path.join(cert_dir, "certificate.crt"), "w") as cert_file:
|
||||
cert_file.write(certificate_response['data']['certificate'])
|
||||
with open(os.path.join(cert_dir, "private.key"), "w") as key_file:
|
||||
key_file.write(certificate_response['data']['private_key'])
|
||||
with open(os.path.join(cert_dir, "full_chain.crt"), "w") as full_chain_file:
|
||||
full_chain_file.write(certificate_response['data']['issuing_ca'] + "\n" + certificate_response['data']['certificate'])
|
||||
else:
|
||||
zip_name = f"{os.path.join(base_path, common_name)}.zip"
|
||||
with ZipFile(zip_name, 'w') as zipf:
|
||||
zipf.writestr("certificate.crt", certificate_response['data']['certificate'])
|
||||
zipf.writestr("private.key", certificate_response['data']['private_key'])
|
||||
zipf.writestr("full_chain.crt", certificate_response['data']['issuing_ca'] + "\n" + certificate_response['data']['certificate'])
|
||||
|
||||
def main(config_file):
|
||||
config = load_config(config_file)
|
||||
parser = argparse.ArgumentParser(description='Request and retrieve a certificate from Vault.')
|
||||
parser.add_argument('common_name', type=str, help='Common Name for the certificate')
|
||||
parser.add_argument('-a', '--alt-names', type=str, default='', help='Comma-separated alternative names for the certificate')
|
||||
parser.add_argument('-i', '--ip-sans', type=str, default='', help='Comma-separated IP Subject Alternative Names for the certificate')
|
||||
parser.add_argument('-e', '--expiry-days', type=int, default=365, help='Validity of the certificate in days (default: 365)')
|
||||
parser.add_argument('-c', '--compress', action='store_true', help='Compress the certificate, key, and full chain into a zip file')
|
||||
parser.add_argument('--json', action='store_true', help='Output results in JSON format')
|
||||
args = parser.parse_args()
|
||||
alt_names = [name.strip() for name in args.alt_names.split(',') if name]
|
||||
ip_sans = [ip.strip() for ip in args.ip_sans.split(',') if ip]
|
||||
certificate_response = request_certificate(args.common_name, alt_names, ip_sans, args.expiry_days, config)
|
||||
if certificate_response:
|
||||
if args.json:
|
||||
save_cert_files(certificate_response, args.common_name, args.compress, config, True)
|
||||
else:
|
||||
save_cert_files(certificate_response, args.common_name, args.compress, config, False)
|
||||
else:
|
||||
print("Failed to obtain certificate.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
config_file = '<%= @config_path %>'
|
||||
main(config_file)
|
||||
@@ -4,4 +4,4 @@ vault:
|
||||
approle_path: '<%= @vault_config['approle_path'] %>'
|
||||
mount_point: '<%= @vault_config['mount_point'] %>'
|
||||
role_name: '<%= @vault_config['role_name'] %>'
|
||||
output_path: '<%= @vault_config['output_path'] %>'
|
||||
output_path: '<%= @vault_config['output_path'] %>'
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
#!<%= @venv_path %>/bin/python
|
||||
import argparse
|
||||
import requests
|
||||
import json
|
||||
import yaml
|
||||
|
||||
# remove this after certs are generated everywhere
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
|
||||
def load_config(config_path):
|
||||
with open(config_path, 'r') as file:
|
||||
config = yaml.safe_load(file)
|
||||
return config['vault']
|
||||
|
||||
def authenticate_approle(vault_config):
|
||||
url = f"{vault_config['addr']}/v1/auth/{vault_config['approle_path']}/login"
|
||||
payload = {
|
||||
"role_id": vault_config['role_id'],
|
||||
}
|
||||
response = requests.post(url, json=payload, verify=False)
|
||||
if response.status_code == 200:
|
||||
auth_response = response.json()
|
||||
return auth_response['auth']['client_token']
|
||||
else:
|
||||
print(f"Error authenticating with AppRole: {response.text}")
|
||||
return None
|
||||
|
||||
def sign_ssh_certificate(vault_config, public_key, valid_principals, ttl):
|
||||
# Authenticate using AppRole and get a token
|
||||
client_token = authenticate_approle(vault_config)
|
||||
if not client_token:
|
||||
print("Failed to authenticate with Vault using AppRole.")
|
||||
return None
|
||||
|
||||
# Prepare the SSH certificate signing request
|
||||
url = f"{vault_config['addr']}/v1/{vault_config['mount_point']}/sign/{vault_config['role_name']}"
|
||||
headers = {'X-Vault-Token': client_token}
|
||||
payload = {
|
||||
"cert_type": "host",
|
||||
"public_key": public_key,
|
||||
"valid_principals": valid_principals,
|
||||
"ttl": ttl
|
||||
}
|
||||
|
||||
# Request the SSH certificate signing
|
||||
response = requests.post(url, headers=headers, json=payload, verify=False)
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
else:
|
||||
print(f"Error requesting certificate: {response.text}")
|
||||
return None
|
||||
|
||||
def main(config_file):
|
||||
config = load_config(config_file)
|
||||
parser = argparse.ArgumentParser(description='Sign SSH host certificate using Vault.')
|
||||
parser.add_argument('--public_key', required=True, help='SSH public key as a string')
|
||||
parser.add_argument('--valid_principals', required=True, help='Comma-separated list of valid principals')
|
||||
parser.add_argument('--ttl', default='87600h', help='Time-to-live for the certificate (default: 87600h)')
|
||||
parser.add_argument('--json', action='store_true', help='Output the resulting certificate as JSON')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Load configuration
|
||||
config = load_config(config_file)
|
||||
|
||||
# Sign SSH certificate
|
||||
response = sign_ssh_certificate(config, args.public_key, args.valid_principals, args.ttl)
|
||||
|
||||
if response and 'data' in response and 'signed_key' in response['data']:
|
||||
if args.json:
|
||||
output = {
|
||||
'signed_key': response['data']['signed_key'],
|
||||
}
|
||||
print(json.dumps(output))
|
||||
else:
|
||||
print(response['data']['signed_key'])
|
||||
else:
|
||||
print("Error: The response does not contain the expected data.")
|
||||
exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
config_file = '<%= @config_path %>'
|
||||
main(config_file)
|
||||
@@ -4,4 +4,3 @@ vault:
|
||||
approle_path: '<%= @vault_config['approle_path'] %>'
|
||||
mount_point: '<%= @vault_config['mount_point'] %>'
|
||||
role_name: '<%= @vault_config['role_name'] %>'
|
||||
output_path: '<%= @vault_config['output_path'] %>'
|
||||
|
||||
@@ -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']
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,11 +1,12 @@
|
||||
# a role to deploy the webserver for packagerepo
|
||||
class roles::infra::reposync::repo {
|
||||
# roles::infra::network::router
|
||||
# an ospf router; frr only, interfaces and firewall are managed outside puppet
|
||||
#
|
||||
class roles::infra::network::router {
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user