Skip to content

Instantly share code, notes, and snippets.

@big-samantha
Created October 25, 2016 01:01
Show Gist options
  • Save big-samantha/ac7bc151911c5b42d0a46333ac534c77 to your computer and use it in GitHub Desktop.
Save big-samantha/ac7bc151911c5b42d0a46333ac534c77 to your computer and use it in GitHub Desktop.
Control a command with a variable or class parameter in Puppet
# Run a command saved as a variable:
$desired_command = '/bin/ls -ld /etc'
exec { 'some arbitrary command':
command => $desired_command,
}
# Run a command inside a class, with a parameter to control the command:
class oracle::setup (
$someparam,
$desired_command,
$someparam,
) {
# some arbitrary puppet code
exec { 'setup command':
command => $desired_command,
}
# some more arbitrary puppet code
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment