| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 class base { | 1 class base ($authority='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 class {'apt': |
| 10 always_apt_update => true | 10 always_apt_update => true |
| 11 } | 11 } |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 32 } | 32 } |
| 33 | 33 |
| 34 service {'cron': | 34 service {'cron': |
| 35 ensure => running, | 35 ensure => running, |
| 36 enable => true, | 36 enable => true, |
| 37 } | 37 } |
| 38 | 38 |
| 39 class {'logrotate': | 39 class {'logrotate': |
| 40 stage => 'post' | 40 stage => 'post' |
| 41 } | 41 } |
| 42 | |
| 43 $servers = hiera("servers") | |
| 44 create_resources(base::explicit_host_record, $servers) | |
| 45 | |
| 46 define explicit_host_record($ip, $ssh_public_key=undef, $role=undef, $dns=unde f) { | |
| 47 | |
| 48 if is_array($ip) { | |
| 49 $internal_ip = $ip[0] | |
| 50 } else { | |
| 51 $internal_ip = $ip | |
| 52 } | |
| 53 | |
| 54 $fqdn_name = join([$name, $authority], ".") | |
| 55 | |
| 56 host{"$name,$internal_ip": | |
|
Wladimir Palant
2014/11/17 16:43:36
Given that each name is resolved to a single IP ad
mathias
2014/11/27 00:30:18
Done.
| |
| 57 ensure => present, | |
| 58 ip => $internal_ip, | |
| 59 name => $fqdn_name, | |
| 60 host_aliases => $dns ? { | |
| 61 undef => [], | |
| 62 default => $dns, | |
| 63 } | |
| 64 } | |
| 65 | |
| 66 if $ssh_public_key != undef { | |
| 67 | |
| 68 $name_key = $dns ? { | |
| 69 undef => $fqdn_name, | |
| 70 default => $dns, | |
| 71 } | |
| 72 | |
| 73 @sshkey {$name: | |
| 74 name => $name_key, | |
| 75 key => $ssh_public_key, | |
| 76 type => ssh-rsa, | |
| 77 host_aliases => $ip, | |
| 78 } | |
| 79 } | |
| 80 | |
| 81 } | |
| 42 } | 82 } |
| 83 | |
| OLD | NEW |