Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/adblockplus/manifests/host.pp

Issue 29336590: Issue 3638 - Introduce class adblockplus::host (Closed)
Patch Set: Created Feb. 18, 2016, 3:09 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | modules/adblockplus/manifests/init.pp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # == Type: adblockplus::host
2 #
3 # Manage host information for any node associated with the same authority.
4 #
5 # This is currently a wrapper around base::explicit_host_record(), but meant
6 # to become the official resource for host information within the adblockplus::*
7 # namespace.
8 #
9 # === Parameters:
10 #
11 # Below please find a description of those parameters which are considered
12 # official:
13 #
14 # [*ensure*]
15 # Whether to ensure the host record being 'present' or 'absent'/'purged'.
16 #
17 # All others have been introduced to resemble the parameter list of type
18 # base::explicit_host_record() and subject to change after the base module
19 # has been removed (see https://issues.adblockplus.org/ticket/3574).
20 #
21 # === Properties:
22 #
23 # The properties listed below are official symbols that may become regular
24 # parameters at some point:
25 #
26 # [*fqdn*]
27 # The fully qualified domain name associated with the host.
28 #
29 # [*ips*]
30 # A list of one or more IPv4 and IPv6 addresses associated with the host.
31 #
32 # [*rsa_public_key*]
33 # The host's public RSA key, i.e "ssh-rsa AA.... host1.example.com".
34 #
35 # For now the values are computed based on the legacy input values.
36 #
37 # === Examples:
38 #
39 # adblockplus::host {'node1':
40 # ensure => 'present',
41 # ip => '10.8.0.1',
42 # }
43 #
44 # adblockplus::host {'node2':
45 # ensure => 'absent',
46 # ip => '10.8.0.2',
47 # }
48 #
49 # $node1 = Adblockplus::Host['node1']
50 # $public_key = getparam($node1, 'rsa_public_key')
51 # $ensure = getparam(Adblockplus::Host['node2'], 'ensure')
52 #
53 define adblockplus::host (
54 $ensure = 'present',
55 $ip,
56 $ssh_public_key = undef,
57 $role = undef,
58 $dns = undef,
59 $groups = undef,
60 ) {
61
62 include adblockplus
63 include base
64
65 # Officially exported and supported instance properties replacing
66 # undocumented magic, see https://issues.adblockplus.org/ticket/3638
67 $fqdn = $dns ? {undef => "$name.$adblockplus::authority", default => "$dns"}
68 $ips = is_array($ip) ? {true => $ip, default => [$ip]}
69 $rsa_public_key = "ssh-rsa $ssh_public_key $fqdn"
70
71 # To become removed together with class base,
72 # see https://issues.adblockplus.org/ticket/3574
73 base::explicit_host_record {$name:
74 ip => $ips,
75 ssh_public_key => $ssh_public_key,
76 role => $role,
77 dns => $fqdn,
78 groups => $groups,
79 }
80
81 # Extracted from base::explicit_host_record() to ensure continuity with
82 # existing records, despite the newly centralized $fqdn computation
83 @host {$fqdn:
84 ensure => $ensure,
85 ip => $ips[0],
86 tag => 'adblockplus::host',
87 }
88 }
OLDNEW
« no previous file with comments | « no previous file | modules/adblockplus/manifests/init.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld