File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 2626ssh root@" $INSTANCE " apt-get update
2727ssh root@" $INSTANCE " apt-get -o Dpkg::Options::=" --force-confold" -o Dpkg::Options::=" --force-confdef" upgrade -y
2828ssh root@" $INSTANCE " apt-get -o Dpkg::Options::=" --force-confold" -o Dpkg::Options::=" --force-confdef" install -y puppet-agent
29+ INSTANCE_IP=$( ssh root@" $INSTANCE " facter networking.ip)
30+ ssh " $PUPPET_SERVER " sudo nft add rule inet filter input tcp dport 8140 ip saddr " $INSTANCE_IP " ct state new accept
2931ssh root@" $INSTANCE " " $PUPPET " config --section agent set server " $PUPPET_SERVER "
3032ssh root@" $INSTANCE " " $PUPPET " config --section agent set environment " $ENVIRONMENT "
3133ssh root@" $INSTANCE " " $PUPPET " agent -t || true
3941
4042ssh " $PUPPET_SERVER " sudo puppetserver ca sign --certname " $INSTANCE "
4143ssh root@" $INSTANCE " " $PUPPET " agent -t
44+ ssh " $PUPPET_SERVER " sudo run-puppet-agent
Original file line number Diff line number Diff line change 11# @summary function to return a list of hosts running a specific resource
22function jqlib::resource_hosts (
33 String[1] $resource_type ,
4- Optional[String[1]] $resource_title = undef ,
4+ Optional[String[1]] $resource_title = undef ,
5+ Boolean $all_environments = false ,
56) >> Array[Stdlib::Host] {
67 $title_query = $resource_title ? {
78 undef => ' ' ,
89 default => " and title = \" ${jqlib::format_puppet_title($resource_title )}\" " ,
910 }
11+ $environment_query = $all_environments .bool2str(' ' , " and environment = \" ${::environment} \" " )
1012
1113 $pql = @(" PQL" )
1214 resources[certname] {
1315 type = " ${jqlib::format_puppet_title($resource_type )}"
1416 ${title_query}
15- and environment = " ${::environment} "
17+ ${environment_query}
1618 }
1719 | PQL
1820
Original file line number Diff line number Diff line change 209209 interval => [' OnCalendar=*-*-* 12:00:00' ],
210210 }
211211
212+ $clients = jqlib::resource_hosts(' class' , ' profile::puppet::agent' , true )
213+ $client_ips = $puppetservers .map |Stdlib::Fqdn $fqdn | { dnsquery::lookup($fqdn , true ) }.flatten
214+
212215 nftables::allow { 'puppetserver' :
213216 proto => ' tcp' ,
214217 dport => 8140,
218+ saddr => $client_ips ,
215219 }
216220
217221 notifier::run_command { 'puppet-public' :
You can’t perform that action at this time.
0 commit comments