Index: modules/base/manifests/init.pp |
=================================================================== |
--- a/modules/base/manifests/init.pp |
+++ b/modules/base/manifests/init.pp |
@@ -1,4 +1,4 @@ |
-class base { |
+class base ($authority='adblockplus.org') { |
Felix Dahlke
2015/03/03 16:43:32
Wouldn't "zone" or maybe "domain" be a more fittin
mathias
2015/03/04 12:32:37
Indeed, let's go with $zone. $domain is much to ov
|
stage {'pre': before => Stage['main']} |
stage {'post': require => Stage['main']} |
@@ -39,4 +39,51 @@ |
class {'logrotate': |
stage => 'post' |
} |
+ |
+ $servers = hiera("servers") |
+ create_resources(base::explicit_host_record, $servers) |
+ |
+ define explicit_host_record( |
+ $ip, |
+ $ssh_public_key = undef, |
+ $role = undef, |
+ $dns = undef, |
+ $groups = undef, |
Wladimir Palant
2015/03/03 20:00:19
This parameter is unused, why did you add it?
mathias
2015/03/04 12:32:37
It's one of the allowed keywords in hosts.yaml, an
|
+ ) { |
+ |
+ if is_array($ip) { |
+ $internal_ip = $ip[0] |
+ } else { |
+ $internal_ip = $ip |
+ } |
+ |
+ $fqdn_name = join([$name, $base::authority], ".") |
+ |
+ host{$name: |
+ ensure => present, |
+ ip => $internal_ip, |
+ name => $fqdn_name, |
+ host_aliases => $dns ? { |
+ undef => [], |
+ default => $dns, |
+ } |
+ } |
+ |
+ if $ssh_public_key != undef { |
+ |
+ $name_key = $dns ? { |
+ undef => $fqdn_name, |
+ default => $dns, |
+ } |
+ |
+ @sshkey {$name: |
+ name => $name_key, |
+ key => $ssh_public_key, |
+ type => ssh-rsa, |
+ host_aliases => $ip, |
+ } |
+ } |
+ |
+ } |
} |
+ |