Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 225bdc6020 | |||
| 3e807201ee | |||
| aeae26711f | |||
| 7b53be7f8c | |||
| 97d21c81c5 | |||
| e140b300bb | |||
| 57c844b7e8 | |||
| 757de20682 | |||
| 6ef1b20abd | |||
| b754d947d5 | |||
| ba35c8907c | |||
| ceacfc85ae | |||
| 7e45e0d2e5 | |||
| 682f65e046 | |||
| 0d412aebdb | |||
| 4b9b28ddb7 | |||
| 0451894b48 | |||
| 3714691240 | |||
| dbe04a91e3 | |||
| 476c8115c5 | |||
| 1d41d07b2d | |||
| 029c998797 | |||
| 0c0d4a3f61 |
@@ -0,0 +1,18 @@
|
|||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: bolt-validate
|
||||||
|
image: git.unkin.net/unkin/almalinux9-puppet-pr-validator:20260317
|
||||||
|
commands:
|
||||||
|
- uvx pre-commit run --all-files --config ci/bolt-validate.yaml
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: default
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 1
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 1
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: epp-validate
|
||||||
|
image: git.unkin.net/unkin/almalinux9-puppet-pr-validator:20260317
|
||||||
|
commands:
|
||||||
|
- uvx pre-commit run --all-files --config ci/epp-validate.yaml
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: default
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 1
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 1
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: erb-validate
|
||||||
|
image: git.unkin.net/unkin/almalinux9-puppet-pr-validator:20260317
|
||||||
|
commands:
|
||||||
|
- uvx pre-commit run --all-files --config ci/erb-validate.yaml
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: default
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 1
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 1
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
when:
|
|
||||||
- event: pull_request
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: pre-commit
|
|
||||||
image: git.unkin.net/unkin/almalinux9-base:latest
|
|
||||||
commands:
|
|
||||||
- dnf groupinstall -y "Development Tools" -y
|
|
||||||
- dnf install uv rubygems ruby-devel gcc make redhat-rpm-config glibc-headers glibc-devel libffi libffi-devel -y
|
|
||||||
- uvx pre-commit run --all-files
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: puppet-lint
|
||||||
|
image: git.unkin.net/unkin/almalinux9-puppet-pr-validator:20260317
|
||||||
|
commands:
|
||||||
|
- uvx pre-commit run --all-files --config ci/puppet-lint.yaml
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: default
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 1
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 1
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: puppet-validate
|
||||||
|
image: git.unkin.net/unkin/almalinux9-puppet-pr-validator:20260317
|
||||||
|
commands:
|
||||||
|
- uvx pre-commit run --all-files --config ci/puppet-validate.yaml
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: default
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 2
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 2
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: ruby-check
|
||||||
|
image: git.unkin.net/unkin/almalinux9-puppet-pr-validator:20260317
|
||||||
|
commands:
|
||||||
|
- uvx pre-commit run --all-files --config ci/ruby-check.yaml
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: default
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 1
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 1
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: ruby-validate
|
||||||
|
image: git.unkin.net/unkin/almalinux9-puppet-pr-validator:20260317
|
||||||
|
commands:
|
||||||
|
- uvx pre-commit run --all-files --config ci/ruby-validate.yaml
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: default
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 1
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 1
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
when:
|
||||||
|
- event: pull_request
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: yamllint
|
||||||
|
image: git.unkin.net/unkin/almalinux9-base:20260606
|
||||||
|
commands:
|
||||||
|
- uvx pre-commit run --all-files --config ci/yamllint.yaml
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
serviceAccountName: default
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 512Mi
|
||||||
|
cpu: 1
|
||||||
|
limits:
|
||||||
|
memory: 2Gi
|
||||||
|
cpu: 1
|
||||||
@@ -53,7 +53,6 @@ mod 'saz-ssh', '13.1.0'
|
|||||||
mod 'saz-limits', '5.0.0'
|
mod 'saz-limits', '5.0.0'
|
||||||
mod 'ghoneycutt-timezone', '4.0.0'
|
mod 'ghoneycutt-timezone', '4.0.0'
|
||||||
mod 'ghoneycutt-puppet', '3.3.0'
|
mod 'ghoneycutt-puppet', '3.3.0'
|
||||||
mod 'dalen-puppetdbquery', '3.0.1'
|
|
||||||
mod 'markt-galera', '3.1.0'
|
mod 'markt-galera', '3.1.0'
|
||||||
mod 'kogitoapp-minio', '1.1.4'
|
mod 'kogitoapp-minio', '1.1.4'
|
||||||
mod 'broadinstitute-certs', '3.0.1'
|
mod 'broadinstitute-certs', '3.0.1'
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
repos:
|
||||||
|
- repo: 'https://github.com/chriskuehl/puppet-pre-commit-hooks.git'
|
||||||
|
rev: v2.2.0
|
||||||
|
hooks:
|
||||||
|
- id: bolt-validate
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
repos:
|
||||||
|
- repo: 'https://github.com/chriskuehl/puppet-pre-commit-hooks.git'
|
||||||
|
rev: v2.2.0
|
||||||
|
hooks:
|
||||||
|
- id: epp-validate
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
repos:
|
||||||
|
- repo: 'https://github.com/chriskuehl/puppet-pre-commit-hooks.git'
|
||||||
|
rev: v2.2.0
|
||||||
|
hooks:
|
||||||
|
- id: erb-validate
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
repos:
|
||||||
|
- repo: 'https://github.com/chriskuehl/puppet-pre-commit-hooks.git'
|
||||||
|
rev: v2.2.0
|
||||||
|
hooks:
|
||||||
|
- id: puppet-lint
|
||||||
|
args:
|
||||||
|
- --no-80chars-check
|
||||||
|
- --no-documentation-check
|
||||||
|
- --no-puppet_url_without_modules-check
|
||||||
|
- --fail-on-warnings
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
repos:
|
||||||
|
- repo: 'https://github.com/chriskuehl/puppet-pre-commit-hooks.git'
|
||||||
|
rev: v2.2.0
|
||||||
|
hooks:
|
||||||
|
- id: puppet-validate
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
repos:
|
||||||
|
- repo: 'https://github.com/chriskuehl/puppet-pre-commit-hooks.git'
|
||||||
|
rev: v2.2.0
|
||||||
|
hooks:
|
||||||
|
- id: ruby-validate
|
||||||
|
- repo: 'https://github.com/jumanjihouse/pre-commit-hooks'
|
||||||
|
rev: 3.0.0
|
||||||
|
hooks:
|
||||||
|
- id: reek
|
||||||
|
- id: rubocop
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
repos:
|
||||||
|
- repo: 'https://github.com/chriskuehl/puppet-pre-commit-hooks.git'
|
||||||
|
rev: v2.2.0
|
||||||
|
hooks:
|
||||||
|
- id: ruby-validate
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
repos:
|
||||||
|
- repo: 'https://github.com/adrienverge/yamllint'
|
||||||
|
rev: v1.32.0
|
||||||
|
hooks:
|
||||||
|
- id: 'yamllint'
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"-d {extends: relaxed, rules: {line-length: disable}, ignore: chart}",
|
||||||
|
"-s",
|
||||||
|
]
|
||||||
@@ -30,6 +30,7 @@ hierarchy:
|
|||||||
- "roles/%{::enc_role_tier1}.eyaml"
|
- "roles/%{::enc_role_tier1}.eyaml"
|
||||||
- "roles/%{::enc_role_tier1}.yaml"
|
- "roles/%{::enc_role_tier1}.yaml"
|
||||||
- "virtual/%{facts.virtual}.yaml"
|
- "virtual/%{facts.virtual}.yaml"
|
||||||
|
- "os/%{facts.os.name}/%{facts.os.name}%{facts.os.release.major}.%{facts.os.release.minor}.yaml"
|
||||||
- "os/%{facts.os.name}/%{facts.os.name}%{facts.os.release.major}.yaml"
|
- "os/%{facts.os.name}/%{facts.os.name}%{facts.os.release.major}.yaml"
|
||||||
- "os/%{facts.os.name}/all_releases.yaml"
|
- "os/%{facts.os.name}/all_releases.yaml"
|
||||||
- "common.eyaml"
|
- "common.eyaml"
|
||||||
|
|||||||
@@ -208,6 +208,20 @@ vault::disable_mlock: false
|
|||||||
profiles::dns::base::nameservers:
|
profiles::dns::base::nameservers:
|
||||||
- 198.18.19.16
|
- 198.18.19.16
|
||||||
profiles::dns::master::basedir: '/var/named/sources'
|
profiles::dns::master::basedir: '/var/named/sources'
|
||||||
|
|
||||||
|
# dns record publishing. During the k8s cutover both methods run; set
|
||||||
|
# manage_export false once k8s is authoritative.
|
||||||
|
# - export: legacy exported-resources -> puppet DNS master
|
||||||
|
# - nsupdate: RFC2136 to the k8s bind-authoritative write endpoint (.9),
|
||||||
|
# inert until the TSIG key is set in eyaml:
|
||||||
|
# profiles::dns::updater::key_secret: ENC[...]
|
||||||
|
# (must match the key the bind-authoritative zones allow-update
|
||||||
|
# with; algorithm hmac-sha256)
|
||||||
|
profiles::dns::updater::manage_export: true
|
||||||
|
profiles::dns::updater::manage_nsupdate: true
|
||||||
|
profiles::dns::updater::server: '198.18.200.9'
|
||||||
|
profiles::dns::updater::key_name: 'client-update'
|
||||||
|
profiles::dns::updater::key_algorithm: 'hmac-sha256'
|
||||||
#profiles::dns::base::ns_role: 'roles::infra::dns::resolver'
|
#profiles::dns::base::ns_role: 'roles::infra::dns::resolver'
|
||||||
#profiles::dns::base::use_ns: 'region'
|
#profiles::dns::base::use_ns: 'region'
|
||||||
profiles::consul::server::members_role: roles::infra::storage::consul
|
profiles::consul::server::members_role: roles::infra::storage::consul
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
haproxy_server_k8s_syd1_traefik_internal: 'k8s-traefik-internal 198.18.200.4:443 ssl verify none check inter 2s rise 3 fall 2'
|
||||||
|
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::ipaddr: "%{hiera('anycast_ip')}"
|
||||||
profiles::haproxy::dns::vrrp_cnames:
|
profiles::haproxy::dns::vrrp_cnames:
|
||||||
- sonarr.main.unkin.net
|
- sonarr.main.unkin.net
|
||||||
@@ -16,6 +19,7 @@ profiles::haproxy::dns::vrrp_cnames:
|
|||||||
- mail.main.unkin.net
|
- mail.main.unkin.net
|
||||||
- autoconfig.main.unkin.net
|
- autoconfig.main.unkin.net
|
||||||
- autodiscover.main.unkin.net
|
- autodiscover.main.unkin.net
|
||||||
|
- auth.unkin.net
|
||||||
|
|
||||||
profiles::haproxy::mappings:
|
profiles::haproxy::mappings:
|
||||||
fe_http:
|
fe_http:
|
||||||
@@ -37,6 +41,7 @@ profiles::haproxy::mappings:
|
|||||||
- 'mail-webadmin.main.unkin.net be_stalwart_webadmin'
|
- 'mail-webadmin.main.unkin.net be_stalwart_webadmin'
|
||||||
- 'autoconfig.main.unkin.net be_stalwart_webadmin'
|
- 'autoconfig.main.unkin.net be_stalwart_webadmin'
|
||||||
- 'autodiscovery.main.unkin.net be_stalwart_webadmin'
|
- 'autodiscovery.main.unkin.net be_stalwart_webadmin'
|
||||||
|
- 'auth.unkin.net be_k8s_kanidm'
|
||||||
fe_https:
|
fe_https:
|
||||||
ensure: present
|
ensure: present
|
||||||
mappings:
|
mappings:
|
||||||
@@ -56,6 +61,7 @@ profiles::haproxy::mappings:
|
|||||||
- 'mail-webadmin.main.unkin.net be_stalwart_webadmin'
|
- 'mail-webadmin.main.unkin.net be_stalwart_webadmin'
|
||||||
- 'autoconfig.main.unkin.net be_stalwart_webadmin'
|
- 'autoconfig.main.unkin.net be_stalwart_webadmin'
|
||||||
- 'autodiscovery.main.unkin.net be_stalwart_webadmin'
|
- 'autodiscovery.main.unkin.net be_stalwart_webadmin'
|
||||||
|
- 'auth.unkin.net be_k8s_kanidm'
|
||||||
|
|
||||||
profiles::haproxy::frontends:
|
profiles::haproxy::frontends:
|
||||||
fe_http:
|
fe_http:
|
||||||
@@ -80,6 +86,7 @@ profiles::haproxy::frontends:
|
|||||||
- 'acl_stalwart_webadmin req.hdr(host) -i mail-webadmin.main.unkin.net'
|
- 'acl_stalwart_webadmin req.hdr(host) -i mail-webadmin.main.unkin.net'
|
||||||
- 'acl_stalwart_webadmin req.hdr(host) -i autoconfig.main.unkin.net'
|
- 'acl_stalwart_webadmin req.hdr(host) -i autoconfig.main.unkin.net'
|
||||||
- 'acl_stalwart_webadmin req.hdr(host) -i autodiscovery.main.unkin.net'
|
- 'acl_stalwart_webadmin req.hdr(host) -i autodiscovery.main.unkin.net'
|
||||||
|
- 'acl_kanidm req.hdr(host) -i auth.unkin.net'
|
||||||
- 'acl_internalsubnets src 198.18.0.0/16 10.10.12.0/24'
|
- 'acl_internalsubnets src 198.18.0.0/16 10.10.12.0/24'
|
||||||
use_backend:
|
use_backend:
|
||||||
- "%[req.hdr(host),lower,map(/etc/haproxy/fe_https.map,be_default)]"
|
- "%[req.hdr(host),lower,map(/etc/haproxy/fe_https.map,be_default)]"
|
||||||
@@ -99,6 +106,7 @@ profiles::haproxy::frontends:
|
|||||||
- 'set-header X-Frame-Options DENY if acl_grafana'
|
- 'set-header X-Frame-Options DENY if acl_grafana'
|
||||||
- 'set-header X-Frame-Options DENY if acl_ceph_dashboard'
|
- 'set-header X-Frame-Options DENY if acl_ceph_dashboard'
|
||||||
- 'set-header X-Frame-Options DENY if acl_stalwart_webadmin'
|
- 'set-header X-Frame-Options DENY if acl_stalwart_webadmin'
|
||||||
|
- 'set-header X-Frame-Options DENY if acl_kanidm'
|
||||||
- 'set-header X-Content-Type-Options nosniff'
|
- 'set-header X-Content-Type-Options nosniff'
|
||||||
- 'set-header X-XSS-Protection 1;mode=block'
|
- 'set-header X-XSS-Protection 1;mode=block'
|
||||||
|
|
||||||
@@ -320,6 +328,26 @@ profiles::haproxy::backends:
|
|||||||
- add-header X-Forwarded-Proto https if { dst_port 9443 }
|
- add-header X-Forwarded-Proto https if { dst_port 9443 }
|
||||||
redirect: 'scheme https if !{ ssl_fc }'
|
redirect: 'scheme https if !{ ssl_fc }'
|
||||||
stick-table: 'type ip size 200k expire 30m'
|
stick-table: 'type ip size 200k expire 30m'
|
||||||
|
be_k8s_kanidm:
|
||||||
|
description: Backend for Kanidm (auth.unkin.net via Kubernetes internal Traefik)
|
||||||
|
collect_exported: false
|
||||||
|
options:
|
||||||
|
balance: roundrobin
|
||||||
|
option:
|
||||||
|
- httpchk
|
||||||
|
- forwardfor
|
||||||
|
- http-keep-alive
|
||||||
|
- prefer-last-server
|
||||||
|
http-check:
|
||||||
|
- 'connect ssl sni auth.unkin.net'
|
||||||
|
- 'send meth GET uri /status ver HTTP/1.1 hdr Host auth.unkin.net'
|
||||||
|
- 'expect status 200'
|
||||||
|
http-reuse: always
|
||||||
|
http-request:
|
||||||
|
- set-header X-Forwarded-Port %[dst_port]
|
||||||
|
- add-header X-Forwarded-Proto https if { dst_port 443 }
|
||||||
|
redirect: 'scheme https if !{ ssl_fc }'
|
||||||
|
server: "%{lookup('haproxy_server_k8s_syd1_traefik_internal')} sni str(auth.unkin.net)"
|
||||||
be_stalwart_imap:
|
be_stalwart_imap:
|
||||||
description: Backend for Stalwart IMAP (STARTTLS)
|
description: Backend for Stalwart IMAP (STARTTLS)
|
||||||
collect_exported: false
|
collect_exported: false
|
||||||
@@ -393,6 +421,7 @@ profiles::haproxy::certlist::certificates:
|
|||||||
- /etc/pki/tls/letsencrypt/git.unkin.net/fullchain_combined.pem
|
- /etc/pki/tls/letsencrypt/git.unkin.net/fullchain_combined.pem
|
||||||
- /etc/pki/tls/letsencrypt/grafana.unkin.net/fullchain_combined.pem
|
- /etc/pki/tls/letsencrypt/grafana.unkin.net/fullchain_combined.pem
|
||||||
- /etc/pki/tls/letsencrypt/dashboard.ceph.unkin.net/fullchain_combined.pem
|
- /etc/pki/tls/letsencrypt/dashboard.ceph.unkin.net/fullchain_combined.pem
|
||||||
|
- /etc/pki/tls/letsencrypt/auth.unkin.net/fullchain_combined.pem
|
||||||
- /etc/pki/tls/vault/certificate.pem
|
- /etc/pki/tls/vault/certificate.pem
|
||||||
|
|
||||||
# additional altnames
|
# additional altnames
|
||||||
@@ -422,3 +451,4 @@ certbot::client::domains:
|
|||||||
- git.unkin.net
|
- git.unkin.net
|
||||||
- grafana.unkin.net
|
- grafana.unkin.net
|
||||||
- dashboard.ceph.unkin.net
|
- dashboard.ceph.unkin.net
|
||||||
|
- auth.unkin.net
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hieradata/os/AlmaLinux/AlmaLinux8.yaml
|
# hieradata/os/AlmaLinux/AlmaLinux8.yaml
|
||||||
---
|
---
|
||||||
crypto_policies::policy: 'DEFAULT'
|
crypto_policies::policy: 'DEFAULT'
|
||||||
|
almalinux-base-repo: almalinux
|
||||||
profiles::packages::include:
|
profiles::packages::include:
|
||||||
network-scripts: {}
|
network-scripts: {}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
almalinux-base-repo: almalinux-vault
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# hieradata/os/AlmaLinux/AlmaLinux9.yaml
|
# hieradata/os/AlmaLinux/AlmaLinux9.yaml
|
||||||
---
|
---
|
||||||
crypto_policies::policy: 'DEFAULT:SHA1'
|
crypto_policies::policy: 'DEFAULT:SHA1'
|
||||||
|
almalinux-base-repo: almalinux
|
||||||
profiles::yum::global::repos:
|
profiles::yum::global::repos:
|
||||||
crb:
|
crb:
|
||||||
ensure: present
|
ensure: present
|
||||||
|
|||||||
@@ -23,45 +23,45 @@ profiles::yum::global::repos:
|
|||||||
name: baseos
|
name: baseos
|
||||||
descr: baseos repository
|
descr: baseos repository
|
||||||
target: /etc/yum.repos.d/baseos.repo
|
target: /etc/yum.repos.d/baseos.repo
|
||||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/BaseOS/%{facts.os.architecture}/os/
|
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/BaseOS/%{facts.os.architecture}/os/
|
||||||
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/BaseOS/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/BaseOS/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
||||||
mirrorlist: absent
|
mirrorlist: absent
|
||||||
extras:
|
extras:
|
||||||
name: extras
|
name: extras
|
||||||
descr: extras repository
|
descr: extras repository
|
||||||
target: /etc/yum.repos.d/extras.repo
|
target: /etc/yum.repos.d/extras.repo
|
||||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/extras/%{facts.os.architecture}/os/
|
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/extras/%{facts.os.architecture}/os/
|
||||||
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/extras/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/extras/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
||||||
mirrorlist: absent
|
mirrorlist: absent
|
||||||
appstream:
|
appstream:
|
||||||
name: appstream
|
name: appstream
|
||||||
descr: appstream repository
|
descr: appstream repository
|
||||||
target: /etc/yum.repos.d/appstream.repo
|
target: /etc/yum.repos.d/appstream.repo
|
||||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/AppStream/%{facts.os.architecture}/os/
|
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/AppStream/%{facts.os.architecture}/os/
|
||||||
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/AppStream/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/AppStream/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
||||||
mirrorlist: absent
|
mirrorlist: absent
|
||||||
highavailability:
|
highavailability:
|
||||||
name: highavailability
|
name: highavailability
|
||||||
descr: highavailability repository
|
descr: highavailability repository
|
||||||
target: /etc/yum.repos.d/highavailability.repo
|
target: /etc/yum.repos.d/highavailability.repo
|
||||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/HighAvailability/%{facts.os.architecture}/os/
|
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/HighAvailability/%{facts.os.architecture}/os/
|
||||||
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/HighAvailability/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/HighAvailability/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
||||||
mirrorlist: absent
|
mirrorlist: absent
|
||||||
crb:
|
crb:
|
||||||
ensure: absent
|
ensure: absent
|
||||||
name: crb
|
name: crb
|
||||||
descr: crb repository
|
descr: crb repository
|
||||||
target: /etc/yum.repos.d/crb.repo
|
target: /etc/yum.repos.d/crb.repo
|
||||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/CRB/%{facts.os.architecture}/os/
|
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/CRB/%{facts.os.architecture}/os/
|
||||||
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/CRB/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/CRB/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
||||||
mirrorlist: absent
|
mirrorlist: absent
|
||||||
powertools:
|
powertools:
|
||||||
ensure: absent
|
ensure: absent
|
||||||
name: powertools
|
name: powertools
|
||||||
descr: powertools repository
|
descr: powertools repository
|
||||||
target: /etc/yum.repos.d/powertools.repo
|
target: /etc/yum.repos.d/powertools.repo
|
||||||
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/PowerTools/%{facts.os.architecture}/os/
|
baseurl: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/PowerTools/%{facts.os.architecture}/os/
|
||||||
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/almalinux/%{facts.os.release.full}/PowerTools/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
gpgkey: https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/%{lookup('almalinux-base-repo')}/%{facts.os.release.full}/PowerTools/%{facts.os.architecture}/os/RPM-GPG-KEY-AlmaLinux-%{facts.os.release.major}
|
||||||
mirrorlist: absent
|
mirrorlist: absent
|
||||||
epel:
|
epel:
|
||||||
name: epel
|
name: epel
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ hiera_include:
|
|||||||
profiles::dns::resolver::acls:
|
profiles::dns::resolver::acls:
|
||||||
acl-main.unkin.net:
|
acl-main.unkin.net:
|
||||||
addresses:
|
addresses:
|
||||||
- 10.10.8.1/32
|
- 198.18.1.10/32
|
||||||
|
- 198.18.2.160/27
|
||||||
- 198.18.21.160/27
|
- 198.18.21.160/27
|
||||||
|
- 198.18.2.192/27
|
||||||
- 198.18.21.192/27
|
- 198.18.21.192/27
|
||||||
- 198.18.13.0/24
|
- 198.18.13.0/24
|
||||||
- 198.18.14.0/24
|
- 198.18.14.0/24
|
||||||
|
|||||||
@@ -82,8 +82,14 @@ profiles::sql::postgresdb::dbname: gitea
|
|||||||
profiles::sql::postgresdb::dbuser: gitea
|
profiles::sql::postgresdb::dbuser: gitea
|
||||||
|
|
||||||
# deploy gitea
|
# deploy gitea
|
||||||
gitea::ensure: '1.22.4'
|
gitea::base_url: 'https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/gitea-dl/gitea'
|
||||||
gitea::checksum: 'd549104f55067e6fb156e7ba060c9af488f36e12d5e747db7563fcc99eaf8532'
|
gitea::install::checksums:
|
||||||
|
1.26.2:
|
||||||
|
linux:
|
||||||
|
amd64: 5b37937b625de69196748f7293eee1a7363f8637ae6e3da3c359bb380bd61a6a
|
||||||
|
|
||||||
|
gitea::ensure: '1.26.2'
|
||||||
|
gitea::checksum: '5b37937b625de69196748f7293eee1a7363f8637ae6e3da3c359bb380bd61a6a'
|
||||||
gitea::manage_user: false
|
gitea::manage_user: false
|
||||||
gitea::manage_group: false
|
gitea::manage_group: false
|
||||||
gitea::manage_home: false
|
gitea::manage_home: false
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ hiera_include:
|
|||||||
- incus
|
- incus
|
||||||
- zfs
|
- zfs
|
||||||
- profiles::ceph::node
|
- profiles::ceph::node
|
||||||
|
- profiles::ceph::mon
|
||||||
|
- profiles::ceph::mgr
|
||||||
|
- profiles::ceph::mds
|
||||||
|
- profiles::ceph::osd
|
||||||
- profiles::ceph::client
|
- profiles::ceph::client
|
||||||
- profiles::ceph::dashboard
|
- profiles::ceph::dashboard
|
||||||
- profiles::storage::cephfsvols
|
- profiles::storage::cephfsvols
|
||||||
@@ -99,7 +103,7 @@ profiles::yum::global::repos:
|
|||||||
profiles::dns::base::primary_interface: loopback0
|
profiles::dns::base::primary_interface: loopback0
|
||||||
|
|
||||||
# dashboard/haproxy
|
# dashboard/haproxy
|
||||||
profiles::ceph::dashboard::ipaddress: "%{hiera('networking_loopback0_ip')}"
|
profiles::ceph::dashboard::ipaddress: "%{hiera('networking_loopback2_ip')}"
|
||||||
|
|
||||||
# networking
|
# networking
|
||||||
systemd::manage_networkd: true
|
systemd::manage_networkd: true
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
hiera_include:
|
hiera_include:
|
||||||
- profiles::selinux::setenforce
|
- profiles::selinux::setenforce
|
||||||
- profiles::ceph::node
|
- profiles::ceph::node
|
||||||
|
- profiles::ceph::osd
|
||||||
- profiles::ceph::client
|
- profiles::ceph::client
|
||||||
- exporters::frr_exporter
|
- exporters::frr_exporter
|
||||||
- frrouting
|
- frrouting
|
||||||
@@ -10,6 +11,62 @@ hiera_include:
|
|||||||
# manage rke2
|
# manage rke2
|
||||||
rke2::bootstrap_node: prodnxsr0001.main.unkin.net
|
rke2::bootstrap_node: prodnxsr0001.main.unkin.net
|
||||||
rke2::join_url: https://join-k8s.service.consul:9345
|
rke2::join_url: https://join-k8s.service.consul:9345
|
||||||
|
rke2::manage_registries: true
|
||||||
|
rke2::registries:
|
||||||
|
docker.io:
|
||||||
|
endpoint:
|
||||||
|
- "https://artifactapi.k8s.syd1.au.unkin.net"
|
||||||
|
rewrite:
|
||||||
|
"^(.*)$": "dockerhub/$1"
|
||||||
|
disable-default-registry-endpoint: true
|
||||||
|
ghcr.io:
|
||||||
|
endpoint:
|
||||||
|
- "https://artifactapi.k8s.syd1.au.unkin.net"
|
||||||
|
rewrite:
|
||||||
|
"^(.*)$": "ghcr/$1"
|
||||||
|
disable-default-registry-endpoint: true
|
||||||
|
quay.io:
|
||||||
|
endpoint:
|
||||||
|
- "https://artifactapi.k8s.syd1.au.unkin.net"
|
||||||
|
rewrite:
|
||||||
|
"^(.*)$": "quay/$1"
|
||||||
|
disable-default-registry-endpoint: true
|
||||||
|
registry.k8s.io:
|
||||||
|
endpoint:
|
||||||
|
- "https://artifactapi.k8s.syd1.au.unkin.net"
|
||||||
|
rewrite:
|
||||||
|
"^(.*)$": "k8s-registry/$1"
|
||||||
|
disable-default-registry-endpoint: true
|
||||||
|
registry.gitlab.com:
|
||||||
|
endpoint:
|
||||||
|
- "https://artifactapi.k8s.syd1.au.unkin.net"
|
||||||
|
rewrite:
|
||||||
|
"^(.*)$": "gitlab/$1"
|
||||||
|
disable-default-registry-endpoint: true
|
||||||
|
docker.elastic.co:
|
||||||
|
endpoint:
|
||||||
|
- "https://artifactapi.k8s.syd1.au.unkin.net"
|
||||||
|
rewrite:
|
||||||
|
"^(.*)$": "elastic/$1"
|
||||||
|
disable-default-registry-endpoint: true
|
||||||
|
gcr.io:
|
||||||
|
endpoint:
|
||||||
|
- "https://artifactapi.k8s.syd1.au.unkin.net"
|
||||||
|
rewrite:
|
||||||
|
"^(.*)$": "gcr/$1"
|
||||||
|
disable-default-registry-endpoint: true
|
||||||
|
docker.litellm.ai:
|
||||||
|
endpoint:
|
||||||
|
- "https://artifactapi.k8s.syd1.au.unkin.net"
|
||||||
|
rewrite:
|
||||||
|
"^(.*)$": "litellm/$1"
|
||||||
|
disable-default-registry-endpoint: true
|
||||||
|
public.ecr.aws:
|
||||||
|
endpoint:
|
||||||
|
- "https://artifactapi.k8s.syd1.au.unkin.net"
|
||||||
|
rewrite:
|
||||||
|
"^(.*)$": "ecr-public/$1"
|
||||||
|
disable-default-registry-endpoint: true
|
||||||
rke2::config_hash:
|
rke2::config_hash:
|
||||||
bind-address: "%{hiera('networking_loopback0_ip')}"
|
bind-address: "%{hiera('networking_loopback0_ip')}"
|
||||||
node-ip: "%{hiera('networking_loopback0_ip')}"
|
node-ip: "%{hiera('networking_loopback0_ip')}"
|
||||||
@@ -125,6 +182,17 @@ frrouting::ospf_exclude_k8s_enable: true
|
|||||||
frrouting::k8s_cluster_cidr: '10.42.0.0/16' # RKE2 cluster-cidr (pods)
|
frrouting::k8s_cluster_cidr: '10.42.0.0/16' # RKE2 cluster-cidr (pods)
|
||||||
frrouting::k8s_service_cidr: '10.43.0.0/16' # RKE2 service-cidr
|
frrouting::k8s_service_cidr: '10.43.0.0/16' # RKE2 service-cidr
|
||||||
|
|
||||||
|
# sysctl recommendations
|
||||||
|
sysctl::base::values:
|
||||||
|
net.ipv4.conf.default.rp_filter:
|
||||||
|
value: '0'
|
||||||
|
net.ipv4.conf.all.rp_filter:
|
||||||
|
value: '0'
|
||||||
|
fs.inotify.max_user_watches:
|
||||||
|
value: '524288'
|
||||||
|
fs.inotify.max_user_instances:
|
||||||
|
value: '512'
|
||||||
|
|
||||||
# add loopback interfaces to ssh list
|
# add loopback interfaces to ssh list
|
||||||
ssh::server::options:
|
ssh::server::options:
|
||||||
ListenAddress:
|
ListenAddress:
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ profiles::metrics::grafana::db_name: "%{hiera('profiles::sql::postgresdb::dbname
|
|||||||
profiles::metrics::grafana::db_user: "%{hiera('profiles::sql::postgresdb::dbuser')}"
|
profiles::metrics::grafana::db_user: "%{hiera('profiles::sql::postgresdb::dbuser')}"
|
||||||
profiles::metrics::grafana::db_pass: "%{hiera('profiles::sql::postgresdb::dbpass')}"
|
profiles::metrics::grafana::db_pass: "%{hiera('profiles::sql::postgresdb::dbpass')}"
|
||||||
profiles::metrics::grafana::pgsql_backend: true
|
profiles::metrics::grafana::pgsql_backend: true
|
||||||
|
profiles::metrics::grafana::version: '13.0.2'
|
||||||
profiles::metrics::grafana::plugins:
|
profiles::metrics::grafana::plugins:
|
||||||
victoriametrics-logs-datasource:
|
victoriametrics-logs-datasource:
|
||||||
ensure: present
|
ensure: present
|
||||||
|
|||||||
@@ -16,3 +16,4 @@ certbot::domains:
|
|||||||
- git.unkin.net
|
- git.unkin.net
|
||||||
- grafana.unkin.net
|
- grafana.unkin.net
|
||||||
- dashboard.ceph.unkin.net
|
- dashboard.ceph.unkin.net
|
||||||
|
- auth.unkin.net
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ profiles::puppet::cobbler_enc::packages:
|
|||||||
- 'requests'
|
- 'requests'
|
||||||
- 'PyYAML'
|
- 'PyYAML'
|
||||||
profiles::puppet::enc::repo: https://git.service.au-syd1.consul/unkinben/puppet-enc.git
|
profiles::puppet::enc::repo: https://git.service.au-syd1.consul/unkinben/puppet-enc.git
|
||||||
profiles::puppet::r10k::r10k_repo: https://git.service.au-syd1.consul/unkin/puppet-r10k.git
|
profiles::puppet::r10k::r10k_repo: https://git.unkin.net/unkin/puppet-r10k.git
|
||||||
profiles::puppet::g10k::bin_path: '/usr/bin/g10k'
|
profiles::puppet::g10k::bin_path: '/usr/bin/g10k'
|
||||||
profiles::puppet::g10k::cfg_path: '/etc/puppetlabs/r10k/r10k.yaml'
|
profiles::puppet::g10k::cfg_path: '/etc/puppetlabs/r10k/r10k.yaml'
|
||||||
profiles::puppet::g10k::environments_path: '/etc/puppetlabs/code/environments'
|
profiles::puppet::g10k::environments_path: '/etc/puppetlabs/code/environments'
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ class externaldns::master inherits externaldns {
|
|||||||
dynamic => true,
|
dynamic => true,
|
||||||
allow_updates => ['key externaldns-key'],
|
allow_updates => ['key externaldns-key'],
|
||||||
allow_transfers => empty($slave_ips) ? {
|
allow_transfers => empty($slave_ips) ? {
|
||||||
true => [],
|
true => ['key externaldns-key'],
|
||||||
false => ['dns-slaves'],
|
false => ['key externaldns-key','dns-slaves'],
|
||||||
},
|
},
|
||||||
ns_notify => !empty($slave_ips),
|
ns_notify => !empty($slave_ips),
|
||||||
also_notify => $slave_ips,
|
also_notify => $slave_ips,
|
||||||
@@ -42,4 +42,4 @@ class externaldns::master inherits externaldns {
|
|||||||
recursion => false,
|
recursion => false,
|
||||||
zones => $externaldns::k8s_zones,
|
zones => $externaldns::k8s_zones,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,12 @@ class incus::cluster (
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if it is, find hosts, sort them so they dont cause changes every run
|
# if it is, find hosts, sort them so they dont cause changes every run
|
||||||
$servers_array = sort(query_nodes("enc_role='${members_role}' and region='${facts['region']}'", 'networking.fqdn'))
|
$servers_array = sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${members_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
# else use provided array from params
|
# else use provided array from params
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'facter'
|
||||||
|
|
||||||
|
# Detects active ceph service instances via systemctl and exposes facts
|
||||||
|
# for use in ceph service management profiles.
|
||||||
|
# rubocop:disable Style/ClassAndModuleChildren
|
||||||
|
module Unkin
|
||||||
|
module Ceph
|
||||||
|
# Detects active ceph service instances via systemctl and exposes Facter facts.
|
||||||
|
module Utils
|
||||||
|
TYPES = %w[mon mgr mds osd].freeze
|
||||||
|
|
||||||
|
def self.services
|
||||||
|
output = Facter::Core::Execution.execute(
|
||||||
|
'systemctl list-units "ceph*" --no-legend --plain --all 2>/dev/null',
|
||||||
|
on_fail: ''
|
||||||
|
)
|
||||||
|
parse_units(output)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.parse_units(output)
|
||||||
|
result = TYPES.each_with_object({}) { |type, hash| hash[type] = [] }
|
||||||
|
output.each_line do |line|
|
||||||
|
unit = line.split.first
|
||||||
|
next unless unit
|
||||||
|
|
||||||
|
match_unit(result, unit)
|
||||||
|
end
|
||||||
|
result
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.match_unit(result, unit)
|
||||||
|
TYPES.each do |type|
|
||||||
|
match = unit.match(/\Aceph-#{type}@(.+)\.service\z/)
|
||||||
|
result[type] << "ceph-#{type}@#{match[1]}" if match
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
TYPES.each do |type|
|
||||||
|
define_singleton_method(:"#{type}?") { !services[type].empty? }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# rubocop:enable Style/ClassAndModuleChildren
|
||||||
|
|
||||||
|
Facter.add('ceph_services') do
|
||||||
|
setcode { Unkin::Ceph::Utils.services }
|
||||||
|
end
|
||||||
|
|
||||||
|
Unkin::Ceph::Utils::TYPES.each do |type|
|
||||||
|
Facter.add("is_ceph_#{type}") do
|
||||||
|
setcode { Unkin::Ceph::Utils.public_send(:"#{type}?") }
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# lib/facter/dns_records.rb
|
||||||
|
#
|
||||||
|
# Reports this host's expected DNS records (assembled by profiles::dns::updater
|
||||||
|
# into its records file) versus what is currently deployed on the authoritative
|
||||||
|
# server, so puppet can detect drift and re-apply.
|
||||||
|
#
|
||||||
|
# Structured value:
|
||||||
|
# { server, count, expected => [{zone,fqdn,type,ttl,value}], in_sync,
|
||||||
|
# drift => [{...,deployed => [...]}] }
|
||||||
|
|
||||||
|
# Helpers for the dns_records fact.
|
||||||
|
module DnsRecordsFact
|
||||||
|
RECORDS_FILE = '/var/lib/dns-updater/records'
|
||||||
|
SERVER_FILE = '/var/lib/dns-updater/server'
|
||||||
|
|
||||||
|
module_function
|
||||||
|
|
||||||
|
# normalise a value for comparison: strip, drop trailing dot, downcase
|
||||||
|
def norm(value)
|
||||||
|
value.to_s.strip.chomp('.').downcase
|
||||||
|
end
|
||||||
|
|
||||||
|
def server
|
||||||
|
File.exist?(SERVER_FILE) ? File.read(SERVER_FILE).strip : nil
|
||||||
|
end
|
||||||
|
|
||||||
|
# a name relative to a zone (or @) as a fully-qualified name
|
||||||
|
def to_fqdn(name, zone)
|
||||||
|
return "#{zone}." if name.to_s.empty? || name == '@'
|
||||||
|
|
||||||
|
"#{name}.#{zone}."
|
||||||
|
end
|
||||||
|
|
||||||
|
# parse one "zone|name|type|ttl|value" line into a record hash (nil to skip)
|
||||||
|
def parse_line(line)
|
||||||
|
line = line.strip
|
||||||
|
return nil if line.empty? || line.start_with?('#')
|
||||||
|
|
||||||
|
zone, name, type, ttl, value = line.split('|', 5)
|
||||||
|
return nil unless zone && type && value
|
||||||
|
|
||||||
|
{ 'zone' => zone, 'fqdn' => to_fqdn(name, zone), 'type' => type, 'ttl' => ttl, 'value' => value }
|
||||||
|
end
|
||||||
|
|
||||||
|
# parse the records file into record hashes
|
||||||
|
def expected
|
||||||
|
return [] unless File.exist?(RECORDS_FILE)
|
||||||
|
|
||||||
|
File.readlines(RECORDS_FILE).filter_map { |line| parse_line(line) }
|
||||||
|
end
|
||||||
|
|
||||||
|
# the values currently deployed for a record, per the authoritative server
|
||||||
|
def deployed(record, srv)
|
||||||
|
cmd = ['dig', '+short', '+time=2', '+tries=1']
|
||||||
|
cmd << "@#{srv}" if srv && !srv.empty?
|
||||||
|
cmd += [record['fqdn'], record['type']]
|
||||||
|
out = Facter::Core::Execution.execute(cmd.join(' '), on_fail: '')
|
||||||
|
out.to_s.split("\n").map { |line| norm(line) }.reject(&:empty?)
|
||||||
|
end
|
||||||
|
|
||||||
|
def report
|
||||||
|
srv = server
|
||||||
|
exp = expected
|
||||||
|
drift = exp.filter_map do |record|
|
||||||
|
dep = deployed(record, srv)
|
||||||
|
record.merge('deployed' => dep) unless dep.include?(norm(record['value']))
|
||||||
|
end
|
||||||
|
{ 'server' => srv, 'count' => exp.length, 'expected' => exp, 'in_sync' => drift.empty?, 'drift' => drift }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Facter.add(:dns_records) do
|
||||||
|
confine kernel: 'Linux'
|
||||||
|
setcode do
|
||||||
|
File.exist?(DnsRecordsFact::RECORDS_FILE) ? DnsRecordsFact.report : nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Convenience boolean for `if $facts['dns_records_insync']` guards.
|
||||||
|
Facter.add(:dns_records_insync) do
|
||||||
|
confine kernel: 'Linux'
|
||||||
|
setcode do
|
||||||
|
v = Facter.value(:dns_records)
|
||||||
|
v.nil? ? nil : v['in_sync']
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -20,7 +20,12 @@ class redisha::redis (
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if it is, find hosts, sort them so they dont cause changes every run
|
# if it is, find hosts, sort them so they dont cause changes every run
|
||||||
$servers_array = sort(query_nodes("enc_role='${redisha_members_role}' and region='${facts['region']}'", 'networking.fqdn'))
|
$servers_array = sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${redisha_members_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
# else use provided array from params
|
# else use provided array from params
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -23,7 +23,12 @@ class redisha::sentinel (
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if it is, find hosts, sort them so they dont cause changes every run
|
# if it is, find hosts, sort them so they dont cause changes every run
|
||||||
$servers_array = sort(query_nodes("enc_role='${redisha_members_role}' and region='${facts['region']}'", 'networking.fqdn'))
|
$servers_array = sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${redisha_members_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
# else use provided array from params
|
# else use provided array from params
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ class rke2::config (
|
|||||||
Stdlib::Fqdn $bootstrap_node = $rke2::bootstrap_node,
|
Stdlib::Fqdn $bootstrap_node = $rke2::bootstrap_node,
|
||||||
String $node_token = $rke2::node_token,
|
String $node_token = $rke2::node_token,
|
||||||
Array[String[1]] $extra_config_files = $rke2::extra_config_files,
|
Array[String[1]] $extra_config_files = $rke2::extra_config_files,
|
||||||
|
Boolean $manage_registries = $rke2::manage_registries,
|
||||||
|
Hash $registries = $rke2::registries,
|
||||||
){
|
){
|
||||||
|
|
||||||
# if its not the bootstrap node, add join path to config
|
# if its not the bootstrap node, add join path to config
|
||||||
@@ -28,6 +30,24 @@ class rke2::config (
|
|||||||
$config = $config_hash
|
$config = $config_hash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $manage_registries {
|
||||||
|
file { '/etc/rancher/rke2/registries.yaml':
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0644',
|
||||||
|
content => epp('rke2/registries.yaml.epp', { registries => $registries }),
|
||||||
|
require => Package["rke2-${node_type}"],
|
||||||
|
notify => Service["rke2-${node_type}"],
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
file { '/etc/rancher/rke2/registries.yaml':
|
||||||
|
ensure => absent,
|
||||||
|
require => Package["rke2-${node_type}"],
|
||||||
|
notify => Service["rke2-${node_type}"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# create the config file
|
# create the config file
|
||||||
file { $config_file:
|
file { $config_file:
|
||||||
ensure => file,
|
ensure => file,
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ class rke2 (
|
|||||||
Hash $helm_repos = $rke2::params::helm_repos,
|
Hash $helm_repos = $rke2::params::helm_repos,
|
||||||
Array[String[1]] $extra_config_files = $rke2::params::extra_config_files,
|
Array[String[1]] $extra_config_files = $rke2::params::extra_config_files,
|
||||||
Stdlib::HTTPUrl $container_archive_source = $rke2::params::container_archive_source,
|
Stdlib::HTTPUrl $container_archive_source = $rke2::params::container_archive_source,
|
||||||
|
Boolean $manage_registries = $rke2::params::manage_registries,
|
||||||
|
Hash $registries = $rke2::params::registries,
|
||||||
) inherits rke2::params {
|
) inherits rke2::params {
|
||||||
|
|
||||||
include rke2::install
|
include rke2::install
|
||||||
|
|||||||
@@ -12,4 +12,6 @@ class rke2::params (
|
|||||||
Hash $helm_repos = {},
|
Hash $helm_repos = {},
|
||||||
Array[String[1]] $extra_config_files = [],
|
Array[String[1]] $extra_config_files = [],
|
||||||
Stdlib::HTTPUrl $container_archive_source = 'https://github.com/rancher/rke2/releases/download',
|
Stdlib::HTTPUrl $container_archive_source = 'https://github.com/rancher/rke2/releases/download',
|
||||||
|
Boolean $manage_registries = false,
|
||||||
|
Hash $registries = {},
|
||||||
) {}
|
) {}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<%- | Hash $registries | -%>
|
||||||
|
---
|
||||||
|
# DO NOT MODIFY - MANAGED BY PUPPET
|
||||||
|
mirrors:
|
||||||
|
<%- $registries.each |$registry, $config| { -%>
|
||||||
|
<%= $registry %>:
|
||||||
|
endpoint:
|
||||||
|
<%- $config['endpoint'].each |$ep| { -%>
|
||||||
|
- "<%= $ep %>"
|
||||||
|
<%- } -%>
|
||||||
|
<%- if $config['rewrite'] { -%>
|
||||||
|
rewrite:
|
||||||
|
<%- $config['rewrite'].each |$pattern, $replacement| { -%>
|
||||||
|
"<%= $pattern %>": "<%= $replacement %>"
|
||||||
|
<%- } -%>
|
||||||
|
<%- } -%>
|
||||||
|
<%- if $config['disable-default-registry-endpoint'] { -%>
|
||||||
|
disable-default-registry-endpoint: true
|
||||||
|
<%- } -%>
|
||||||
|
<%- } -%>
|
||||||
@@ -167,7 +167,13 @@ class stalwart (
|
|||||||
|
|
||||||
# Query cluster members for validation
|
# Query cluster members for validation
|
||||||
$cluster_query = "enc_role='${cluster_role}' and country='${facts['country']}' and region='${facts['region']}'"
|
$cluster_query = "enc_role='${cluster_role}' and country='${facts['country']}' and region='${facts['region']}'"
|
||||||
$cluster_members_raw = query_nodes($cluster_query, 'networking.fqdn')
|
$cluster_members_raw = puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${cluster_role}' and
|
||||||
|
certname in facts[certname] { name = 'country' and value = '${facts['country']}' } and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] }
|
||||||
$cluster_members = $cluster_members_raw ? {
|
$cluster_members = $cluster_members_raw ? {
|
||||||
undef => [],
|
undef => [],
|
||||||
default => $cluster_members_raw,
|
default => $cluster_members_raw,
|
||||||
@@ -180,7 +186,20 @@ class stalwart (
|
|||||||
|
|
||||||
# Query HAProxy nodes for proxy trusted networks
|
# Query HAProxy nodes for proxy trusted networks
|
||||||
$haproxy_query = "enc_role='${haproxy_role}' and country='${facts['country']}' and region='${facts['region']}'"
|
$haproxy_query = "enc_role='${haproxy_role}' and country='${facts['country']}' and region='${facts['region']}'"
|
||||||
$haproxy_members_raw = query_nodes($haproxy_query, 'networking.ip')
|
$haproxy_members_raw = puppetdb_query(
|
||||||
|
"facts[certname,value] {
|
||||||
|
name = 'networking' and
|
||||||
|
certname in facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${haproxy_role}'
|
||||||
|
} and
|
||||||
|
certname in facts[certname] {
|
||||||
|
name = 'country' and value = '${facts['country']}'
|
||||||
|
} and
|
||||||
|
certname in facts[certname] {
|
||||||
|
name = 'region' and value = '${facts['region']}'
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['value']['ip'] }
|
||||||
$haproxy_ips = $haproxy_members_raw ? {
|
$haproxy_ips = $haproxy_members_raw ? {
|
||||||
undef => [],
|
undef => [],
|
||||||
default => sort($haproxy_members_raw),
|
default => sort($haproxy_members_raw),
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
class profiles::ceph::mds (
|
||||||
|
Boolean $ensure_running = true,
|
||||||
|
) {
|
||||||
|
|
||||||
|
if $ensure_running and $facts['is_ceph_mds'] {
|
||||||
|
$facts['ceph_services']['mds'].each |String $svc| {
|
||||||
|
service { $svc:
|
||||||
|
ensure => running,
|
||||||
|
enable => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
class profiles::ceph::mgr (
|
||||||
|
Boolean $ensure_running = true,
|
||||||
|
) {
|
||||||
|
|
||||||
|
if $ensure_running and $facts['is_ceph_mgr'] {
|
||||||
|
$facts['ceph_services']['mgr'].each |String $svc| {
|
||||||
|
service { $svc:
|
||||||
|
ensure => running,
|
||||||
|
enable => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
class profiles::ceph::mon (
|
||||||
|
Boolean $ensure_running = true,
|
||||||
|
) {
|
||||||
|
|
||||||
|
if $ensure_running and $facts['is_ceph_mon'] {
|
||||||
|
$facts['ceph_services']['mon'].each |String $svc| {
|
||||||
|
service { $svc:
|
||||||
|
ensure => running,
|
||||||
|
enable => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
class profiles::ceph::osd (
|
||||||
|
Boolean $ensure_running = true,
|
||||||
|
) {
|
||||||
|
|
||||||
|
if $ensure_running and $facts['is_ceph_osd'] {
|
||||||
|
$facts['ceph_services']['osd'].each |String $svc| {
|
||||||
|
service { $svc:
|
||||||
|
ensure => running,
|
||||||
|
enable => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,7 +28,12 @@ class profiles::consul::client (
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if it is, find hosts, sort them so they dont cause changes every run
|
# if it is, find hosts, sort them so they dont cause changes every run
|
||||||
$servers_array = sort(query_nodes("enc_role='${members_role}' and region='${::facts['region']}'", 'networking.fqdn'))
|
$servers_array = sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${members_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${::facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
# else use provided array from params
|
# else use provided array from params
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -65,12 +65,22 @@ class profiles::consul::server (
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if it is, find hosts, sort them so they dont cause changes every run
|
# if it is, find hosts, sort them so they dont cause changes every run
|
||||||
$servers_array = sort(query_nodes("enc_role='${members_role}' and region='${::facts['region']}'", 'networking.fqdn'))
|
$servers_array = sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${members_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${::facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
if $join_remote_regions {
|
if $join_remote_regions {
|
||||||
# get all nodes in the members_role for each other region
|
# get all nodes in the members_role for each other region
|
||||||
$region_to_servers = $remote_regions.reduce({}) |$memo, $region| {
|
$region_to_servers = $remote_regions.reduce({}) |$memo, $region| {
|
||||||
$servers = sort(query_nodes("enc_role='${members_role}' and region='${region}'", 'networking.fqdn'))
|
$servers = sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${members_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${region}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
$memo + { $region => $servers }
|
$memo + { $region => $servers }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,16 +11,38 @@ class profiles::dns::base (
|
|||||||
Optional[String] $ns_role = undef,
|
Optional[String] $ns_role = undef,
|
||||||
){
|
){
|
||||||
|
|
||||||
# install bind_utils
|
# install bind_utils (provides nsupdate)
|
||||||
include bind::updater
|
include bind::updater
|
||||||
|
|
||||||
|
# assemble the host's DNS records and nsupdate them to the authoritative server
|
||||||
|
include profiles::dns::updater
|
||||||
|
|
||||||
# if ns_role is set, find all hosts matching that enc_role
|
# if ns_role is set, find all hosts matching that enc_role
|
||||||
$nameserver_array = $ns_role ? {
|
$nameserver_array = $ns_role ? {
|
||||||
undef => $nameservers,
|
undef => $nameservers,
|
||||||
default => $use_ns ? {
|
default => $use_ns ? {
|
||||||
'all' => query_nodes("enc_role='${ns_role}'", 'networking.ip'),
|
'all' => puppetdb_query(
|
||||||
'region' => query_nodes("enc_role='${ns_role}' and region=${facts['region']}", 'networking.ip'),
|
"facts[certname,value] {
|
||||||
'country' => query_nodes("enc_role='${ns_role}' and country=${facts['country']}", 'networking.ip'),
|
name = 'networking' and
|
||||||
|
certname in nodes[certname] { facts.enc_role = '${ns_role}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['value']['ip'] },
|
||||||
|
'region' => puppetdb_query(
|
||||||
|
"facts[certname,value] {
|
||||||
|
name = 'networking' and
|
||||||
|
certname in nodes[certname] {
|
||||||
|
facts.enc_role = '${ns_role}' and facts.region = '${facts['region']}'
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['value']['ip'] },
|
||||||
|
'country' => puppetdb_query(
|
||||||
|
"facts[certname,value] {
|
||||||
|
name = 'networking' and
|
||||||
|
certname in nodes[certname] {
|
||||||
|
facts.enc_role = '${ns_role}' and facts.country = '${facts['country']}'
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['value']['ip'] },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,21 @@ class profiles::dns::master (
|
|||||||
$nameservers_array = $ns_role ? {
|
$nameservers_array = $ns_role ? {
|
||||||
undef => [$facts['networking']['fqdn']],
|
undef => [$facts['networking']['fqdn']],
|
||||||
default => $use_ns ? {
|
default => $use_ns ? {
|
||||||
'all' => sort(query_nodes("enc_role='${ns_role}'", 'networking.fqdn')),
|
'all' => sort(puppetdb_query(
|
||||||
'region' => sort(query_nodes("enc_role='${ns_role}' and region=${facts['region']}", 'networking.fqdn')),
|
"facts[certname] { name = 'enc_role' and value = '${ns_role}' }"
|
||||||
'country' => sort(query_nodes("enc_role='${ns_role}' and country=${facts['country']}", 'networking.fqdn')),
|
).map |$fact| { $fact['certname'] }),
|
||||||
|
'region' => sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${ns_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] }),
|
||||||
|
'country' => sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${ns_role}' and
|
||||||
|
certname in facts[certname] { name = 'country' and value = '${facts['country']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] }),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +44,9 @@ class profiles::dns::master (
|
|||||||
$facts['networking']['fqdn'] => $facts['networking']['ip']
|
$facts['networking']['fqdn'] => $facts['networking']['ip']
|
||||||
},
|
},
|
||||||
default => $nameservers_array.reduce({}) |$acc, $fqdn| {
|
default => $nameservers_array.reduce({}) |$acc, $fqdn| {
|
||||||
$result = query_nodes("networking.fqdn='${fqdn}'", 'networking.ip')
|
$result = puppetdb_query(
|
||||||
|
"facts[certname,value] { name = 'networking' and certname = '${fqdn}' }"
|
||||||
|
).map |$fact| { $fact['value']['ip'] }
|
||||||
$ip = $result[0]
|
$ip = $result[0]
|
||||||
$acc + { "${fqdn}." => $ip }
|
$acc + { "${fqdn}." => $ip }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
# defines the base record that will be exported
|
# profiles::dns::record
|
||||||
|
#
|
||||||
|
# Declares a DNS record for this host. Publishes it via either or both methods,
|
||||||
|
# controlled by profiles::dns::updater's toggles (both on during cutover):
|
||||||
|
# - nsupdate: a local concat fragment consumed by profiles::dns::updater,
|
||||||
|
# which nsupdates it to the authoritative server.
|
||||||
|
# - export: the legacy @@concat::fragment exported to the puppet DNS master.
|
||||||
define profiles::dns::record (
|
define profiles::dns::record (
|
||||||
String $record,
|
String $record,
|
||||||
Enum[
|
Enum[
|
||||||
@@ -13,11 +19,26 @@ define profiles::dns::record (
|
|||||||
String $value,
|
String $value,
|
||||||
String $zone,
|
String $zone,
|
||||||
Integer $order,
|
Integer $order,
|
||||||
Stdlib::AbsolutePath $basedir = lookup('profiles::dns::master::basedir'),
|
Integer $ttl = 300,
|
||||||
) {
|
) {
|
||||||
@@concat::fragment { "${zone}_${name}":
|
include profiles::dns::updater
|
||||||
target => "${basedir}/${zone}.conf",
|
|
||||||
content => "${record} IN ${type} ${value}\n",
|
# new: local records file consumed by the nsupdate service
|
||||||
order => $order,
|
if $profiles::dns::updater::manage_nsupdate {
|
||||||
|
# zone|name|type|ttl|value (parsed by the dns-update script)
|
||||||
|
concat::fragment { "dns-record-${name}":
|
||||||
|
target => $profiles::dns::updater::records_file,
|
||||||
|
content => "${zone}|${record}|${type}|${ttl}|${value}\n",
|
||||||
|
order => sprintf('%03d', $order),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# legacy: export the fragment to the puppet DNS master
|
||||||
|
if $profiles::dns::updater::manage_export {
|
||||||
|
@@concat::fragment { "${zone}_${name}":
|
||||||
|
target => "${profiles::dns::updater::master_basedir}/${zone}.conf",
|
||||||
|
content => "${record} IN ${type} ${value}\n",
|
||||||
|
order => $order,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
# profiles::dns::updater
|
||||||
|
#
|
||||||
|
# Publishes this host's DNS records. Two methods, independently toggled so both
|
||||||
|
# can run during the k8s cutover (profiles::dns::record honours the same flags):
|
||||||
|
#
|
||||||
|
# - nsupdate ($manage_nsupdate): assemble the records into a local file and
|
||||||
|
# nsupdate them to the k8s authoritative write endpoint via a systemd .path
|
||||||
|
# unit that watches the file. Inert until $key_secret (TSIG) is set.
|
||||||
|
# - export ($manage_export): the legacy exported-resources flow to the puppet
|
||||||
|
# DNS master. Kept during cutover; disable once k8s is authoritative.
|
||||||
|
#
|
||||||
|
# nsupdate comes from bind-utils (installed via bind::updater in
|
||||||
|
# profiles::dns::base).
|
||||||
|
class profiles::dns::updater (
|
||||||
|
Boolean $manage_nsupdate = true,
|
||||||
|
Boolean $manage_export = true,
|
||||||
|
String $server = '198.18.200.9',
|
||||||
|
String $key_name = 'client-update',
|
||||||
|
String $key_algorithm = 'hmac-sha256',
|
||||||
|
Optional[Sensitive[String]] $key_secret = undef,
|
||||||
|
Integer $default_ttl = 300,
|
||||||
|
Stdlib::AbsolutePath $records_file = '/var/lib/dns-updater/records',
|
||||||
|
Stdlib::AbsolutePath $state_dir = '/var/lib/dns-updater',
|
||||||
|
Stdlib::AbsolutePath $config_dir = '/etc/dns-updater',
|
||||||
|
Stdlib::AbsolutePath $master_basedir = lookup('profiles::dns::master::basedir'),
|
||||||
|
) {
|
||||||
|
|
||||||
|
$state_file = "${state_dir}/applied"
|
||||||
|
$server_file = "${state_dir}/server"
|
||||||
|
$key_file = "${config_dir}/key"
|
||||||
|
|
||||||
|
if $manage_nsupdate {
|
||||||
|
|
||||||
|
file { $state_dir:
|
||||||
|
ensure => directory,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Server address, read by the dns_records fact for drift detection.
|
||||||
|
file { $server_file:
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0644',
|
||||||
|
content => "${server}\n",
|
||||||
|
require => File[$state_dir],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Records file, assembled from profiles::dns::record fragments.
|
||||||
|
concat { $records_file:
|
||||||
|
ensure => present,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0644',
|
||||||
|
ensure_newline => true,
|
||||||
|
warn => false,
|
||||||
|
require => File[$state_dir],
|
||||||
|
}
|
||||||
|
|
||||||
|
concat::fragment { 'dns-update-header':
|
||||||
|
target => $records_file,
|
||||||
|
content => "# Managed by puppet (profiles::dns::record): zone|name|type|ttl|value\n",
|
||||||
|
order => '00',
|
||||||
|
}
|
||||||
|
|
||||||
|
if $key_secret =~ Undef {
|
||||||
|
notify { 'dns-updater-inert':
|
||||||
|
message => 'profiles::dns::updater: key_secret unset; records assembled but not applied.',
|
||||||
|
loglevel => 'info',
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
file { $config_dir:
|
||||||
|
ensure => directory,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0700',
|
||||||
|
}
|
||||||
|
|
||||||
|
file { $key_file:
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0600',
|
||||||
|
show_diff => false,
|
||||||
|
content => Sensitive(epp('profiles/dns/tsig-key.epp', {
|
||||||
|
'name' => $key_name,
|
||||||
|
'algorithm' => $key_algorithm,
|
||||||
|
'secret' => $key_secret.unwrap,
|
||||||
|
})),
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/usr/local/bin/dns-update':
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
content => epp('profiles/dns/dns-update.sh.epp', {
|
||||||
|
'server' => $server,
|
||||||
|
'key_file' => $key_file,
|
||||||
|
'records_file' => $records_file,
|
||||||
|
'state_file' => $state_file,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
systemd::unit_file { 'dns-update.service':
|
||||||
|
content => epp('profiles/dns/dns-update.service.epp', { 'script' => '/usr/local/bin/dns-update' }),
|
||||||
|
}
|
||||||
|
|
||||||
|
# The .path unit watches the records file and triggers the service.
|
||||||
|
systemd::unit_file { 'dns-update.path':
|
||||||
|
content => epp('profiles/dns/dns-update.path.epp', { 'records_file' => $records_file }),
|
||||||
|
active => true,
|
||||||
|
enable => true,
|
||||||
|
}
|
||||||
|
|
||||||
|
# Also apply within the puppet run whenever the records change.
|
||||||
|
exec { 'dns-update-apply':
|
||||||
|
command => '/usr/local/bin/dns-update',
|
||||||
|
refreshonly => true,
|
||||||
|
subscribe => Concat[$records_file],
|
||||||
|
require => [File['/usr/local/bin/dns-update'], File[$key_file]],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,12 @@ class profiles::etcd::node (
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if it is, find hosts, sort them so they dont cause changes every run
|
# if it is, find hosts, sort them so they dont cause changes every run
|
||||||
$servers_array = sort(query_nodes("enc_role='${members_role}' and region='${facts['region']}'", 'networking.fqdn'))
|
$servers_array = sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${members_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
# else use provided array from params
|
# else use provided array from params
|
||||||
}else{
|
}else{
|
||||||
@@ -31,7 +36,7 @@ class profiles::etcd::node (
|
|||||||
$initial_cluster = $servers_array.map |$fqdn| {
|
$initial_cluster = $servers_array.map |$fqdn| {
|
||||||
|
|
||||||
# lookup the ip address for the current fqdn
|
# lookup the ip address for the current fqdn
|
||||||
$ip = query_nodes("networking.fqdn='${fqdn}'", 'networking.ip')[0]
|
$ip = puppetdb_query("facts[certname,value] { name = 'networking' and certname = '${fqdn}' }").map |$fact| { $fact['value']['ip'] }[0]
|
||||||
|
|
||||||
# construct the string for this server
|
# construct the string for this server
|
||||||
"${fqdn}=https://${ip}:${peer_port}"
|
"${fqdn}=https://${ip}:${peer_port}"
|
||||||
|
|||||||
@@ -30,13 +30,14 @@ class profiles::haproxy::dns (
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if it is, find hosts, sort them so they dont cause changes every run
|
# if it is, find hosts, sort them so they dont cause changes every run
|
||||||
$servers_array = sort(query_nodes(
|
$servers_array = sort(puppetdb_query(
|
||||||
"enc_role='${facts['enc_role']}' and
|
"facts[certname] {
|
||||||
country='${facts['country']}' and
|
name = 'enc_role' and value = '${facts['enc_role']}' and
|
||||||
region='${facts['region']}' and
|
certname in facts[certname] { name = 'country' and value = '${facts['country']}' } and
|
||||||
environment='${facts['environment']}'",
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' } and
|
||||||
'networking.fqdn'
|
certname in facts[certname] { name = 'environment' and value = '${facts['environment']}' }
|
||||||
))
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
# give enough time for a few hosts to be provisioned
|
# give enough time for a few hosts to be provisioned
|
||||||
if length($servers_array) >= 3 {
|
if length($servers_array) >= 3 {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# profiles::metrics::grafana
|
# profiles::metrics::grafana
|
||||||
class profiles::metrics::grafana (
|
class profiles::metrics::grafana (
|
||||||
String $ldap_bind_pass,
|
String $ldap_bind_pass,
|
||||||
|
String $version = 'installed',
|
||||||
Stdlib::Port $http_port = 8080,
|
Stdlib::Port $http_port = 8080,
|
||||||
String $app_mode = 'production',
|
String $app_mode = 'production',
|
||||||
Boolean $allow_sign_up = false,
|
Boolean $allow_sign_up = false,
|
||||||
@@ -107,6 +108,7 @@ class profiles::metrics::grafana (
|
|||||||
|
|
||||||
# deploy grafana
|
# deploy grafana
|
||||||
class { 'grafana':
|
class { 'grafana':
|
||||||
|
version => $version,
|
||||||
cfg => $cfg,
|
cfg => $cfg,
|
||||||
ldap_cfg => $ldap_cfg,
|
ldap_cfg => $ldap_cfg,
|
||||||
plugins => $plugins,
|
plugins => $plugins,
|
||||||
|
|||||||
@@ -98,8 +98,15 @@ class profiles::minio::server (
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if it is, find hosts, sort them so they dont cause changes every run
|
# if it is, find hosts, sort them so they dont cause changes every run
|
||||||
#$servers_array = sort(query_nodes("enc_role='${minio_members_role}'", 'networking.fqdn'))
|
#$servers_array = sort(puppetdb_query(
|
||||||
$servers_array = sort(query_nodes("enc_role='${minio_members_role}' and minio_region='${minio_region}'", 'networking.fqdn'))
|
# "facts[certname] { name = 'enc_role' and value = '${minio_members_role}' }"
|
||||||
|
#).map |$fact| { $fact['certname'] })
|
||||||
|
$servers_array = sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${minio_members_role}' and
|
||||||
|
certname in facts[certname] { name = 'minio_region' and value = '${minio_region}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
# else use provided array from params
|
# else use provided array from params
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -26,9 +26,21 @@ class profiles::ntp::client (
|
|||||||
$ntpserver_array = $ntp_role ? {
|
$ntpserver_array = $ntp_role ? {
|
||||||
undef => $peers,
|
undef => $peers,
|
||||||
default => $use_ntp ? {
|
default => $use_ntp ? {
|
||||||
'all' => query_nodes("enc_role='${ntp_role}'", 'networking.fqdn'),
|
'all' => puppetdb_query(
|
||||||
'region' => query_nodes("enc_role='${ntp_role}' and region=${facts['region']}", 'networking.fqdn'),
|
"facts[certname] { name = 'enc_role' and value = '${ntp_role}' }"
|
||||||
'country' => query_nodes("enc_role='${ntp_role}' and country=${facts['country']}", 'networking.fqdn'),
|
).map |$fact| { $fact['certname'] },
|
||||||
|
'region' => puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${ntp_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] },
|
||||||
|
'country' => puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${ntp_role}' and
|
||||||
|
certname in facts[certname] { name = 'country' and value = '${facts['country']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,13 @@ class profiles::proxmox::clusterinit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$servers_array = sort(query_nodes(
|
$servers_array = sort(puppetdb_query(
|
||||||
"enc_role='${membersrole}' and country='${facts['country']}' and region='${facts['region']}'",
|
"facts[certname] {
|
||||||
'networking.fqdn'
|
name = 'enc_role' and value = '${membersrole}' and
|
||||||
))
|
certname in facts[certname] { name = 'country' and value = '${facts['country']}' } and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
if ! $profiles::proxmox::params::pve_clusterinit_master {
|
if ! $profiles::proxmox::params::pve_clusterinit_master {
|
||||||
if !empty($servers_array) {
|
if !empty($servers_array) {
|
||||||
|
|||||||
@@ -11,13 +11,14 @@ class profiles::proxmox::clusterjoin {
|
|||||||
$root_password = $profiles::proxmox::params::root_password
|
$root_password = $profiles::proxmox::params::root_password
|
||||||
|
|
||||||
# query puppetdb for list of cluster members
|
# query puppetdb for list of cluster members
|
||||||
$members_array = sort(query_nodes(
|
$members_array = sort(puppetdb_query(
|
||||||
"enc_role='${membersrole}' and \
|
"facts[certname] {
|
||||||
country='${facts['country']}' and \
|
name = 'enc_role' and value = '${membersrole}' and
|
||||||
region='${facts['region']}' and \
|
certname in facts[certname] { name = 'country' and value = '${facts['country']}' } and
|
||||||
pve_cluster.cluster_name='${clustername}'",
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' } and
|
||||||
'networking.fqdn'
|
certname in facts[certname] { name = 'pve_cluster' and value.cluster_name = '${clustername}' }
|
||||||
))
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
# check if the pve kernerl is running
|
# check if the pve kernerl is running
|
||||||
if $facts['kernelrelease'] == $profiles::proxmox::params::pve_kernel_release {
|
if $facts['kernelrelease'] == $profiles::proxmox::params::pve_kernel_release {
|
||||||
|
|||||||
@@ -48,7 +48,12 @@ class profiles::sql::galera_member (
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if it is, find hosts, sort them so they dont cause changes every run
|
# if it is, find hosts, sort them so they dont cause changes every run
|
||||||
$servers_array = sort(query_nodes("enc_role='${galera_members_role}' and region='${facts['region']}'", 'networking.fqdn'))
|
$servers_array = sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${galera_members_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
# else use provided array from params
|
# else use provided array from params
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -18,7 +18,12 @@ class profiles::sql::postgresdb (
|
|||||||
}
|
}
|
||||||
|
|
||||||
# if it is, find hosts, sort them so they dont cause changes every run
|
# if it is, find hosts, sort them so they dont cause changes every run
|
||||||
$servers_array = sort(query_nodes("enc_role='${members_role}' and region='${facts['region']}'", 'networking.fqdn'))
|
$servers_array = sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${members_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
# else use provided array from params
|
# else use provided array from params
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -29,7 +29,12 @@ class profiles::vault::server (
|
|||||||
if $members_lookup and $members_role != undef {
|
if $members_lookup and $members_role != undef {
|
||||||
|
|
||||||
# if it is, find hosts, sort them so they dont cause changes every run
|
# if it is, find hosts, sort them so they dont cause changes every run
|
||||||
$servers_array = sort(query_nodes("enc_role='${members_role}' and region='${::facts['region']}'", 'networking.fqdn'))
|
$servers_array = sort(puppetdb_query(
|
||||||
|
"facts[certname] {
|
||||||
|
name = 'enc_role' and value = '${members_role}' and
|
||||||
|
certname in facts[certname] { name = 'region' and value = '${::facts['region']}' }
|
||||||
|
}"
|
||||||
|
).map |$fact| { $fact['certname'] })
|
||||||
|
|
||||||
# else use provided array from params
|
# else use provided array from params
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<%- | String $records_file | -%>
|
||||||
|
[Unit]
|
||||||
|
Description=Watch the DNS records file and apply changes
|
||||||
|
|
||||||
|
[Path]
|
||||||
|
PathModified=<%= $records_file %>
|
||||||
|
Unit=dns-update.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<%- | String $script | -%>
|
||||||
|
[Unit]
|
||||||
|
Description=Apply host DNS records via nsupdate
|
||||||
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=<%= $script %>
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<%- | String $server, String $key_file, String $records_file, String $state_file | -%>
|
||||||
|
#!/bin/bash
|
||||||
|
# Managed by puppet (profiles::dns::updater). Applies this host's records to the
|
||||||
|
# authoritative DNS server via TSIG nsupdate. Only the delta since the last
|
||||||
|
# successful run is sent; removed records are deleted.
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SERVER="<%= $server %>"
|
||||||
|
KEYFILE="<%= $key_file %>"
|
||||||
|
RECORDS="<%= $records_file %>"
|
||||||
|
STATE="<%= $state_file %>"
|
||||||
|
|
||||||
|
[ -f "$RECORDS" ] || exit 0
|
||||||
|
touch "$STATE"
|
||||||
|
|
||||||
|
# Format per line: zone|name|type|ttl|value (name is relative to zone, or @).
|
||||||
|
desired="$(grep -vE '^[[:space:]]*(#|$)' "$RECORDS" | sort -u || true)"
|
||||||
|
applied="$(grep -vE '^[[:space:]]*(#|$)' "$STATE" 2>/dev/null | sort -u || true)"
|
||||||
|
|
||||||
|
[ "$desired" = "$applied" ] && exit 0
|
||||||
|
|
||||||
|
fqdn() { # name zone
|
||||||
|
if [ -z "$1" ] || [ "$1" = "@" ]; then printf '%s.' "$2"; else printf '%s.%s.' "$1" "$2"; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
msg="$(mktemp)"
|
||||||
|
trap 'rm -f "$msg"' EXIT
|
||||||
|
printf 'server %s\n' "$SERVER" >> "$msg"
|
||||||
|
|
||||||
|
# Process per zone so each UPDATE message targets a single zone.
|
||||||
|
zones="$(printf '%s\n%s\n' "$desired" "$applied" | cut -d'|' -f1 | sort -u | grep -v '^$' || true)"
|
||||||
|
for zone in $zones; do
|
||||||
|
printf 'zone %s.\n' "$zone" >> "$msg"
|
||||||
|
# Additions/updates: replace the RRset for every desired record in this zone.
|
||||||
|
printf '%s\n' "$desired" | awk -F'|' -v z="$zone" 'NF>=5 && $1==z' | \
|
||||||
|
while IFS='|' read -r z name type ttl value; do
|
||||||
|
f="$(fqdn "$name" "$z")"
|
||||||
|
printf 'update delete %s %s\n' "$f" "$type" >> "$msg"
|
||||||
|
printf 'update add %s %s %s %s\n' "$f" "$ttl" "$type" "$value" >> "$msg"
|
||||||
|
done
|
||||||
|
# Deletions: records present last run but gone now.
|
||||||
|
comm -23 <(printf '%s\n' "$applied") <(printf '%s\n' "$desired") | \
|
||||||
|
awk -F'|' -v z="$zone" 'NF>=5 && $1==z' | \
|
||||||
|
while IFS='|' read -r z name type ttl value; do
|
||||||
|
f="$(fqdn "$name" "$z")"
|
||||||
|
printf 'update delete %s %s %s\n' "$f" "$type" "$value" >> "$msg"
|
||||||
|
done
|
||||||
|
printf 'send\n' >> "$msg"
|
||||||
|
done
|
||||||
|
|
||||||
|
if nsupdate -k "$KEYFILE" "$msg"; then
|
||||||
|
printf '%s\n' "$desired" > "$STATE"
|
||||||
|
else
|
||||||
|
echo "dns-update: nsupdate to ${SERVER} failed" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<%- | String $name, String $algorithm, String $secret | -%>
|
||||||
|
key "<%= $name %>" {
|
||||||
|
algorithm <%= $algorithm %>;
|
||||||
|
secret "<%= $secret %>";
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user