Skip to content

Instantly share code, notes, and snippets.

@Ancillas
Last active August 29, 2015 14:11
Show Gist options
  • Save Ancillas/61e1ad67eba65a7529d2 to your computer and use it in GitHub Desktop.
Save Ancillas/61e1ad67eba65a7529d2 to your computer and use it in GitHub Desktop.
Puppet conditional testing
class test1 {
$color = 'dirt'
if ($color != 'dirt') or ($color != 'blue') {
notify {"test1: conditional true": }
} else {
notify {"test1: conditional false": }
}
}
class test2 {
$color = 'blue'
if ($color != 'dirt') or ($color != 'blue') {
notify {"test2: conditional true": }
} else {
notify {"test2: condit:onal false": }
}
}
class test3 {
$color = 'red'
if ($color != 'dirt') or ($color != 'blue') {
notify {"test3: conditional true": }
} else {
notify {"test3: conditional false": }
}
}
notify {"puppet version = ${::puppetversion}":} ->
class {'test1': } ->
class {'test2': } ->
class {'test3': }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment