Cfengine Perform action based on variable value

Posted by Daniel on Server Fault See other posts from Server Fault or by Daniel
Published on 2013-10-17T14:48:44Z Indexed on 2013/10/18 10:00 UTC
Read the original article Hit count: 305

In cfengine, I have a variable that is set to the output of a command. Let say variable myoutput is set to "hi world". How can I execute a command based on the contents of myoutput.

I would like to do something like this (sudo cfengine code):

bundle agent test
{

    vars:
        "myoutput" string => execresult("echo 'hi world';","noshell");

    commands:
        myoutput=="hi world"::
            "/usr/bin/php myaction.php";  
}

© Server Fault or respective owner

Related posts about configuration-management

Related posts about cfengine