Dr Bunsen Honeydew
06/02/2022, 8:45 PMMike Renfro
06/03/2022, 2:01 AM$vhosts
hash we use to create Apache VirtualHosts, I’m trying to extract all the servername
values to make a list of SANs for a host-wide SSL key.
Testing with printing out the servername
values:
$vhosts.map |String $key, Hash $vhost| {
notify { "$key":
message => $vhost['servername']
}
}
prints one message per vhost entry with the defined servername
value, no problem:
Notice: <http://phpappst1.tntech.edu|phpappst1.tntech.edu>
Notice: /Stage[main]/Profile::Apache/Notify[phpapps]/message: defined 'message' as '<http://phpappst1.tntech.edu|phpappst1.tntech.edu>'
Notice: <http://phpappst1.tntech.edu|phpappst1.tntech.edu>
Notice: /Stage[main]/Profile::Apache/Notify[phpapps-ssl]/message: defined 'message' as '<http://phpappst1.tntech.edu|phpappst1.tntech.edu>'
Notice: <http://ttupaapp-test.tntech.edu|ttupaapp-test.tntech.edu>
Notice: /Stage[main]/Profile::Apache/Notify[ttupaapp]/message: defined 'message' as '<http://ttupaapp-test.tntech.edu|ttupaapp-test.tntech.edu>'
...
But trying to convert that into an array of names:
$servernames = $vhosts.map |String $key, Hash $vhost| {
$vhost['servername']
}
notify { "servernames":
message => $servernames
}
appears to only return the first value:
Notice: <http://phpappst1.tntech.edu|phpappst1.tntech.edu>
Notice: /Stage[main]/Profile::Apache/Notify[servernames]/message: defined 'message' as '<http://phpappst1.tntech.edu|phpappst1.tntech.edu>'
Where can I narrow this down? Puppet 6.27 if that makes any difference.helindbe
06/03/2022, 8:27 AMjoin()
function to join the names with commas for example.helindbe
06/03/2022, 8:28 AMpuppet apply -e 'notify {blah: message => [a, b, c].join(", ")}'
Notice: Compiled catalog for localhost in environment production in 0.03 seconds
Notice: a, b, c
Notice: /Stage[main]/Main/Notify[blah]/message: defined 'message' as 'a, b, c'
Notice: Applied catalog in 0.01 seconds
bastelfreak
06/03/2022, 8:36 AM$ary = ['1', 2, 'bla']
notify { 'foo':
message => "${ary}",
}
Notice: [1, 2, bla]
Notice: /Stage[main]/Main/Notify[foo]/message: defined 'message' as '[1, 2, bla]'
Notice: Applied catalog in 0.01 seconds
Mike Renfro
06/03/2022, 10:32 AMSlackbot
06/03/2022, 3:16 PMcsharpsteen
06/03/2022, 3:29 PMlookup('<lookup value>', Hash)
is a lookup that returns the first value found, instead of all possible values, and fails if that value is not a Hash
type.csharpsteen
06/03/2022, 3:29 PMlookup('<lookup value>', Hash)
is a lookup that returns the first value found, instead of merging all possible values, and fails if that value is not a Hash
type.Slackbot
06/03/2022, 4:11 PMrajeshr
06/03/2022, 4:12 PMhost
resource. every time the agent runs, it updates the timestamp inside the /etc/hosts
file:
HEADER: This file was autogenerated at *2022-06-03 11:06:26 -0400*
Is there a way to stop the timestamp being updated inside the /etc/hosts
file every time the agent runs or use something other that the host
resource?Slackbot
06/03/2022, 7:00 PMSlackbot
06/03/2022, 7:31 PMJason Grammenos
06/03/2022, 7:31 PMreload
parameter in addition to the restart one, would potential make it way cleanerthedonkdonk
06/03/2022, 7:32 PMminute => [13,28,43,58]
Jason Grammenos
06/03/2022, 7:32 PMJason Grammenos
06/03/2022, 7:33 PMJason Grammenos
06/03/2022, 7:33 PMSlackbot
06/03/2022, 9:51 PMMike Renfro
06/03/2022, 10:10 PMMassimiliano (Max)
06/05/2022, 5:35 PMmatt
06/06/2022, 8:14 AMmatt
06/06/2022, 8:15 AMmatt
06/06/2022, 8:15 AMglee
06/06/2022, 8:25 AMversioncmp
function - https://puppet.com/docs/puppet/6/function.html#versioncmp, so for your example:
if versioncmp($::sw_version, '1.9.11') >= 0) {
[...do stuff here...]
}
would do stuff if version was 1.9.11 or greatermatt
06/06/2022, 8:26 AMmatt
06/06/2022, 8:26 AMmatt
06/06/2022, 8:26 AMglee
06/06/2022, 8:27 AMmatt
06/06/2022, 8:28 AM