Puppet resources have metaparameters like 'notify', 'subscribe', 'before',
'require' that make it possible to make things happen in the desired
sequence; so it is possible to have 'exec' resources that trigger on some
conditions.
It might be going a bit beyond the intention of Puppet; but you could
create a file if an error occurs, and then test using 'onlyif' in an 'exec'
to create a ticket if the file exists.
Or you can create custom modules and implement the logic in Ruby code.
On Wednesday, 20 December 2017 15:35:56 UTC+2, buoyant_puppy wrote:
>
> How can I get the result of an action and use it conditionally in my code?
> As a very simple example:
>
> package { "wget" : ensure => 'present' }
> # if that failed, do X
>
> To put this in context, some actual use cases I have:
> - attempt to register an agent to a remote service and if that fails, open
> a ticket via an API so it can be manually resolved
> - attempt to create an LV and if that fails, call another module that adds
> some new LUNs to my host, extend VG etc...
> - ensure some critical service is running, but in case of any error raise
> an alert via the standard alert API
> - when applying some security-related code, confirm success/failure to a
> compliance product API
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/37c1fc2b-c5d2-4269-8a75-7b1cb10215e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.