vchepkov
07/26/2023, 7:24 PMvchepkov
07/26/2023, 7:24 PMvchepkov
07/26/2023, 7:25 PMjms1
07/26/2023, 7:25 PMexec actually runs a script which prints a message in big ugly red text, reminding the user to restart nginx (some servers we cannot restart nginx without a maintenance window because it causes a flood of client re-connects) ... the class containing the exec is flagged with stage => 'deploy' so the message prints at the end of the agent run ... so in this case, using a notify wouldn't hurt anything ...natemccurdy
07/26/2023, 7:26 PMthe exec actually runs a script which prints a message in big ugly red text....that's what the
notify resource is for.
notify { 'restart the server':
loglevel => 'error',
}jms1
07/26/2023, 7:26 PMjms1
07/26/2023, 7:27 PM\033[0;1;37;44m%s\033[0m in the string to make the message stand out.jms1
07/26/2023, 7:28 PMnatemccurdy
07/26/2023, 7:28 PMloglevel => 'error', is for. That'll colorize. the output of the notify based on Puppet's usual loglevel formatting.
warn => yellow
error => redjms1
07/26/2023, 7:29 PMstage => 'deploy' to a notify? if so, that might make my life a WHOLE lot easierjms1
07/26/2023, 7:29 PMCVQuesty
07/26/2023, 7:30 PMif ( $condition ) {
exec {'x':
----
}
}
This satisfies your statement: when declared, doesn't have any real effect on the target server, other than triggering the exec.CVQuesty
07/26/2023, 7:30 PMjms1
07/26/2023, 7:35 PMexec runs a shell script containing a printf command, which prints a message using ANSI sequences to make it visually stand out ... ideally, the message needs to be printed at the very end of the agent run, so it exists in a class which is declared with stage => 'deploy', and the exec has refreshonly => true ... the code has a config file with notify => Exec['x'], but it also needs to notify the same exec if a specific custom fact is truejms1
07/26/2023, 7:36 PMnotify resource with the same notify => Exec['x'] attribute. it'll be extra output, but as long as the script's message is at the end, it'll have the desired effect.natemccurdy
07/26/2023, 8:07 PMrefreshonly value dependent on the value of that fact. For example:
if $facts['something'] == 'blah' {
$exec_refreshonly = false
} else {
$exec_refreshonly = true
}
exec { 'notify-users':
command => '/some/script.sh',
refreshonly => $exec_refreshonly,
}
Or simplified down:
exec { 'notify-users':
command => '/some/script.sh',
refreshonly => $facts['something'] != 'blah',
}natemccurdy
07/26/2023, 8:09 PMSlackbot
07/26/2023, 8:35 PMnate
07/26/2023, 8:38 PMpuppet lookup for a key on a node running puppetserver with puppetdb integration yields the correct value in the right place.
Path "/etc/puppetlabs/code/environments/test_branch/data/groups/service.yaml"
Original path: "groups/%{group}.yaml"
Found key: "puppet::server_jvm_min_heap_size" value: "3G"
when running a node on this test branch, this value and some others affecting puppet agent and puppet server conf change to the module defaults. if lookups succeed, the hiera files are all in place and syntactically correct, what else might cause this? the only thing i can think of is if this branch somehow isn’t deployed to a server this agent is pointed at. we’re using srv records, and the environment successfully deployed to all compile nodes.Varun Sharma
07/26/2023, 8:52 PMSlackbot
07/26/2023, 8:54 PMSlackbot
07/26/2023, 9:38 PMSlackbot
07/26/2023, 11:56 PMSlackbot
07/27/2023, 9:41 AMSlackbot
07/27/2023, 12:41 PMemerson_prado
07/27/2023, 3:41 PMemerson_prado
07/27/2023, 3:45 PMSlackbot
07/27/2023, 4:34 PMDr Bunsen Honeydew
07/27/2023, 5:45 PMSlackbot
07/27/2023, 6:13 PM