OLD | NEW |
1 class base ($zone='adblockplus.org') { | 1 class base ($zone='adblockplus.org') { |
2 stage {'pre': before => Stage['main']} | 2 stage {'pre': before => Stage['main']} |
3 stage {'post': require => Stage['main']} | 3 stage {'post': require => Stage['main']} |
4 | 4 |
5 class {'users': | 5 class {'users': |
6 stage => 'pre', | 6 stage => 'pre', |
7 } | 7 } |
8 | 8 |
9 class {'apt': | 9 if !defined(Class['apt']) { |
10 always_apt_update => true | 10 class {'apt': |
| 11 always_apt_update => true |
| 12 } |
11 } | 13 } |
12 | 14 |
13 Exec['apt_update'] -> Package <| |> | 15 Exec['apt_update'] -> Package <| |> |
14 | 16 |
15 include private::users, postfix, ssh | 17 include private::users, postfix, ssh |
16 | 18 |
17 package {['mercurial', 'vim', 'emacs', 'debian-goodies', 'htop']: | 19 package {['mercurial', 'vim', 'emacs', 'debian-goodies', 'htop']: |
18 ensure => present, | 20 ensure => present, |
19 } | 21 } |
20 | 22 |
(...skipping 24 matching lines...) Expand all Loading... |
45 $servers = hiera('servers') | 47 $servers = hiera('servers') |
46 create_resources(base::explicit_host_record, $servers) | 48 create_resources(base::explicit_host_record, $servers) |
47 | 49 |
48 define explicit_host_record( | 50 define explicit_host_record( |
49 $ip, | 51 $ip, |
50 $ssh_public_key = undef, | 52 $ssh_public_key = undef, |
51 $role = undef, | 53 $role = undef, |
52 $dns = undef, | 54 $dns = undef, |
53 $groups = undef, | 55 $groups = undef, |
54 ) { | 56 ) { |
55 | 57 |
56 if is_array($ip) { | 58 if is_array($ip) { |
57 $internal_ip = $ip[0] | 59 $internal_ip = $ip[0] |
58 } else { | 60 } else { |
59 $internal_ip = $ip | 61 $internal_ip = $ip |
60 } | 62 } |
61 | 63 |
62 $fqdn_name = join([$name, $base::zone], '.') | 64 $fqdn_name = join([$name, $base::zone], '.') |
63 | 65 |
64 host{$name: | 66 host{$name: |
65 ensure => present, | 67 ensure => present, |
66 ip => $internal_ip, | 68 ip => $internal_ip, |
67 name => $fqdn_name, | 69 name => $fqdn_name, |
68 host_aliases => $dns ? { | 70 host_aliases => $dns ? { |
69 undef => [], | 71 undef => [], |
70 default => $dns, | 72 default => $dns, |
71 } | 73 } |
72 } | 74 } |
73 | 75 |
74 if $ssh_public_key != undef { | 76 if $ssh_public_key != undef { |
75 | 77 |
76 $name_key = $dns ? { | 78 $name_key = $dns ? { |
77 undef => $fqdn_name, | 79 undef => $fqdn_name, |
78 default => $dns, | 80 default => $dns, |
79 } | 81 } |
80 | 82 |
81 @sshkey {$name: | 83 @sshkey {$name: |
82 name => $name_key, | 84 name => $name_key, |
83 key => $ssh_public_key, | 85 key => $ssh_public_key, |
84 type => ssh-rsa, | 86 type => ssh-rsa, |
85 host_aliases => $ip, | 87 host_aliases => $ip, |
86 } | 88 } |
87 } | 89 } |
88 | 90 |
89 } | 91 } |
90 } | 92 } |
91 | 93 |
OLD | NEW |