Skip to content

Instantly share code, notes, and snippets.

@awaxa
Last active August 29, 2015 14:15
Show Gist options
  • Save awaxa/fe243246d6661df889d1 to your computer and use it in GitHub Desktop.
Save awaxa/fe243246d6661df889d1 to your computer and use it in GitHub Desktop.
---
sites:
- domain: 'www.example.com'
- domain: 'www2.example.com'
ip: '1.1.1.1'
[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
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