Skip to content

Commit

Permalink
(site/{dev,ls}) add firewall rules for node_exporter scraping
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoblitt committed Nov 14, 2023
1 parent 77e18f1 commit 71a18ba
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hieradata/site/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,12 @@ accounts::user_list:

letsencrypt::server: "https://acme-staging.api.letsencrypt.org/directory" # testing url
profile::core::common::disable_ipv6: true

profile::core::firewall::firewall:
"100 accept node_exporter":
proto: "tcp"
state: "NEW"
ipset: "ayekan src"
dport: "9100"
action: "accept"
require: "Ipset::Set[ayekan]"
9 changes: 9 additions & 0 deletions hieradata/site/ls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,12 @@ accounts::user_list:
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsF9VQ7wjm0Rm/1HA6Zc94IAkhqol5cwT44MwwR6uzDyo+/tqa8awUnmVF+RyiJaR6NEKO6YhjkIPga7rDQJerCMLg/xfFzpRcKSi+Xw5YCQ3Z+4P8XZrICM2vzDV6rBELl4n8Bzk6ncXOcKwbUitw3aj6bJNduv6hGrhkJKlWob+cXGH+KZwDiLX82hxsWmktRWcwDEaXTFWq6dahg3/0niAojkfo2ZlJtRblSEgUBf7JITeXBGYAunAeUYE93xUC9tB1OIzisQLQKCFM2OgSjnO4NSx2r4nIPYhEOEhBnNBqF9mPqalRjoyimvF+lu/vsZ43r7nZyV4RwYbyfmVL [email protected]"

profile::core::common::disable_ipv6: true

profile::core::firewall::firewall:
"100 accept node_exporter":
proto: "tcp"
state: "NEW"
ipset: "ayekan src"
dport: "9100"
action: "accept"
require: "Ipset::Set[ayekan]"
1 change: 1 addition & 0 deletions spec/hosts/roles/perfsonar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
include_examples 'generic perfsonar', facts: facts
include_examples 'ipset'
include_examples 'firewall default', facts: facts
include_examples 'firewall node_exporter scraping', site: site

it do
is_expected.to contain_yum__versionlock('perfsonar-toolkit').with(
Expand Down
16 changes: 16 additions & 0 deletions spec/support/spec/firewall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,19 @@
)
end
end

shared_examples 'firewall node_exporter scraping' do |site:|
case site
when 'dev', 'ls'
it do
is_expected.to contain_firewall('100 accept node_exporter').with(
proto: 'tcp',
state: 'NEW',
ipset: 'ayekan src',
dport: '9100',
action: 'accept',
require: 'Ipset::Set[ayekan]',
)
end
end
end

0 comments on commit 71a18ba

Please sign in to comment.