Skip to content

Commit

Permalink
add selector
Browse files Browse the repository at this point in the history
  • Loading branch information
aisuhua committed Jul 9, 2018
1 parent 1381927 commit a4af28e
Showing 1 changed file with 34 additions and 25 deletions.
59 changes: 34 additions & 25 deletions manifests/site.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,48 @@
include notify
}

#$myname1 = 'lala'
#class example {
# $myname2 = 'suhua'
# notify {"Message from elsewhere: $myname1, $myname2":
#
# }
#}
#notify {"I love you $myname1, $myname2":}

$global_variable = 'global'

File {
ensure => file,
owner => 'suhua'
}

node ubuntu-test2 {
#include example
#$parent_variable = 'parent'
#include scope_example

# if
if $operatingsystem == 'Ubuntu' {
notify { "I am running on $operatingsystem.":

}
}
elsif $operatingsystem == 'CentOS' {
notify { "Who are you?":

}
}

# in
if $operatingsystem in ['Ubuntu', 'CentOS'] {
notify { "I am ruuning on $operatingsystem.":

$myname = 'suhuazizi'
$mybody = 'lalalal'
$num = 10
notify{ "${myname}${mybody} is am good boy.":
}
}

# case
case $operatingsystem {
'Ubuntu': {
$variable = 'ubuntu'
}
'CentOS': {
$variable = 'centos'
}
}

notify { "environment: $environment, cert: $clientcert, version: $clientversion":
notify { "I an running on $variable.":

}

# selector
$mysystem = $operatingsystem ? {
'Ubuntu' => 'ubuntu-xxx',
'CentOS' => 'centos-xxx',
}

notify { "servername: $servername, serverip: $serverip, version: $serverversion, module: $module_name":
notify { "I am running on $mysystem":

}
}
Expand Down

0 comments on commit a4af28e

Please sign in to comment.