Last active
August 29, 2015 14:15
-
-
Save awaxa/fe243246d6661df889d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
sites: | |
- domain: 'www.example.com' | |
- domain: 'www2.example.com' | |
ip: '1.1.1.1' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@master ~]# puppet apply test.pp | |
Notice: Compiled catalog for master in environment production in 0.12 seconds | |
Notice: www.example.com has no ip | |
Notice: /Stage[main]/Main/Site[{"domain"=>"www.example.com"}]/Notify[www.example.com has no ip]/message: defined 'message' as 'www.example.com has no ip' | |
Notice: www2.example.com on 1.1.1.1 | |
Notice: /Stage[main]/Main/Site[{"domain"=>"www2.example.com", "ip"=>"1.1.1.1"}]/Notify[www2.example.com on 1.1.1.1]/message: defined 'message' as 'www2.example.com on 1.1.1.1' | |
Notice: Finished catalog run in 0.18 seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define site() { | |
$domain = $title['domain'] | |
$ip = $title['ip'] | |
if $ip { | |
notify { "${domain} on ${ip}": } | |
} | |
else { | |
notify { "${domain} has no ip": } | |
} | |
} | |
$sites = hiera('sites') | |
site { $sites: } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment