| Index: modules/adblockplus/manifests/host.pp |
| diff --git a/modules/adblockplus/manifests/host.pp b/modules/adblockplus/manifests/host.pp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b35d00a9c6c66fc8230ca8b2aa5b946baf87b47e |
| --- /dev/null |
| +++ b/modules/adblockplus/manifests/host.pp |
| @@ -0,0 +1,88 @@ |
| +# == Type: adblockplus::host |
| +# |
| +# Manage host information for any node associated with the same authority. |
| +# |
| +# This is currently a wrapper around base::explicit_host_record(), but meant |
| +# to become the official resource for host information within the adblockplus::* |
| +# namespace. |
| +# |
| +# === Parameters: |
| +# |
| +# Below please find a description of those parameters which are considered |
| +# official: |
| +# |
| +# [*ensure*] |
| +# Whether to ensure the host record being 'present' or 'absent'/'purged'. |
| +# |
| +# All others have been introduced to resemble the parameter list of type |
| +# base::explicit_host_record() and subject to change after the base module |
| +# has been removed (see https://issues.adblockplus.org/ticket/3574). |
| +# |
| +# === Properties: |
| +# |
| +# The properties listed below are official symbols that may become regular |
| +# parameters at some point: |
| +# |
| +# [*fqdn*] |
| +# The fully qualified domain name associated with the host. |
| +# |
| +# [*ips*] |
| +# A list of one or more IPv4 and IPv6 addresses associated with the host. |
| +# |
| +# [*rsa_public_key*] |
| +# The host's public RSA key, i.e "ssh-rsa AA.... host1.example.com". |
| +# |
| +# For now the values are computed based on the legacy input values. |
| +# |
| +# === Examples: |
| +# |
| +# adblockplus::host {'node1': |
| +# ensure => 'present', |
| +# ip => '10.8.0.1', |
| +# } |
| +# |
| +# adblockplus::host {'node2': |
| +# ensure => 'absent', |
| +# ip => '10.8.0.2', |
| +# } |
| +# |
| +# $node1 = Adblockplus::Host['node1'] |
| +# $public_key = getparam($node1, 'rsa_public_key') |
| +# $ensure = getparam(Adblockplus::Host['node2'], 'ensure') |
| +# |
| +define adblockplus::host ( |
| + $ensure = 'present', |
| + $ip, |
| + $ssh_public_key = undef, |
| + $role = undef, |
| + $dns = undef, |
| + $groups = undef, |
| +) { |
| + |
| + include adblockplus |
| + include base |
| + |
| + # Officially exported and supported instance properties replacing |
| + # undocumented magic, see https://issues.adblockplus.org/ticket/3638 |
| + $fqdn = $dns ? {undef => "$name.$adblockplus::authority", default => "$dns"} |
| + $ips = is_array($ip) ? {true => $ip, default => [$ip]} |
| + $rsa_public_key = "ssh-rsa $ssh_public_key $fqdn" |
| + |
| + # To become removed together with class base, |
| + # see https://issues.adblockplus.org/ticket/3574 |
| + base::explicit_host_record {$name: |
| + ip => $ips, |
| + ssh_public_key => $ssh_public_key, |
| + role => $role, |
| + dns => $fqdn, |
| + groups => $groups, |
| + } |
| + |
| + # Extracted from base::explicit_host_record() to ensure continuity with |
| + # existing records, despite the newly centralized $fqdn computation |
| + @host {$fqdn: |
| + ensure => $ensure, |
| + ip => $ips[0], |
| + tag => 'adblockplus::host', |
| + } |
| +} |