Index: modules/base/manifests/init.pp |
diff --git a/modules/base/manifests/init.pp b/modules/base/manifests/init.pp |
index e18c9848e63ab1284b23ea62e8093d82775a6e55..295cc20209c6e0885814a6fbd1ebc1a786c01352 100644 |
--- a/modules/base/manifests/init.pp |
+++ b/modules/base/manifests/init.pp |
@@ -41,45 +41,34 @@ class base ($zone='adblockplus.org') { |
$groups = undef, |
) { |
- if is_array($ip) { |
- $internal_ip = $ip[0] |
- } else { |
- $internal_ip = $ip |
+ $fqdn = $dns ? { |
+ undef => "$name.${base::zone}", |
+ default => $dns, |
} |
- $fqdn_name = join([$name, $base::zone], '.') |
- |
- host{$name: |
- ensure => present, |
- ip => $internal_ip, |
- name => $fqdn_name, |
- host_aliases => $dns ? { |
- undef => [], |
- default => $dns, |
- } |
+ $ips = is_array($ip) ? { |
+ true => $ip, |
+ default => [$ip], |
} |
- if $ssh_public_key != undef { |
- |
- $name_key = $dns ? { |
- undef => $fqdn_name, |
- default => $dns, |
- } |
+ $public_key = $ssh_public_key ? { |
+ undef => undef, |
+ default => "ssh-rsa $ssh_public_key $fqdn", |
+ } |
- @sshkey {$name: |
- name => $name_key, |
- key => $ssh_public_key, |
- type => ssh-rsa, |
- host_aliases => $ip, |
- tag => 'base::explicit_host_record', |
- } |
+ adblockplus::host {$title: |
+ fqdn => $fqdn, |
+ groups => $groups, |
+ ips => $ips, |
+ name => $name, |
+ role => $role, |
+ public_key => $public_key, |
} |
- } |
- # Work around https://projects.puppetlabs.com/issues/4145 |
- Sshkey<| |> -> |
- file {'/etc/ssh/ssh_known_hosts': |
- ensure => 'present', |
- mode => 0644, |
+ # Implicit realization behavior has been introduced by accident in a |
+ # previous version, hence it should be kept until class base is obsolete |
+ # and the obsolete records have been removed |
+ realize(Host[$title]) |
+ realize(Sshkey[$title]) |
} |
} |