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

Side by Side Diff: modules/base/manifests/init.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 | « modules/adblockplus/manifests/init.pp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 if !defined(Class['apt']) { 9 if !defined(Class['apt']) {
10 class {'apt': 10 class {'apt':
(...skipping 27 matching lines...) Expand all
38 38
39 service {'cron': 39 service {'cron':
40 ensure => running, 40 ensure => running,
41 enable => true, 41 enable => true,
42 } 42 }
43 43
44 class {'logrotate': 44 class {'logrotate':
45 stage => 'post' 45 stage => 'post'
46 } 46 }
47 47
48 $servers = hiera('servers')
49 create_resources(base::explicit_host_record, $servers)
50
51 define explicit_host_record( 48 define explicit_host_record(
52 $ip, 49 $ip,
53 $ssh_public_key = undef, 50 $ssh_public_key = undef,
54 $role = undef, 51 $role = undef,
55 $dns = undef, 52 $dns = undef,
56 $groups = undef, 53 $groups = undef,
57 ) { 54 ) {
58 55
59 if is_array($ip) {
60 $internal_ip = $ip[0]
61 } else {
62 $internal_ip = $ip
63 }
64
65 $fqdn_name = join([$name, $base::zone], '.')
66
67 host{$name:
68 ensure => present,
69 ip => $internal_ip,
70 name => $fqdn_name,
71 host_aliases => $dns ? {
72 undef => [],
73 default => $dns,
74 }
75 }
76
77 if $ssh_public_key != undef { 56 if $ssh_public_key != undef {
78 57
79 $name_key = $dns ? { 58 $name_key = $dns ? {
80 undef => $fqdn_name, 59 undef => $name,
81 default => $dns, 60 default => $dns,
82 } 61 }
83 62
84 @sshkey {$name: 63 @sshkey {$name_key:
85 name => $name_key,
86 key => $ssh_public_key, 64 key => $ssh_public_key,
87 type => ssh-rsa, 65 type => ssh-rsa,
88 host_aliases => $ip, 66 host_aliases => $ip,
89 tag => 'base::explicit_host_record', 67 tag => 'base::explicit_host_record',
90 } 68 }
91 } 69 }
92 } 70 }
93 71
94 # Work around https://projects.puppetlabs.com/issues/4145 72 # Work around https://projects.puppetlabs.com/issues/4145
95 Sshkey<| |> -> 73 Sshkey<| |> ->
96 file {'/etc/ssh/ssh_known_hosts': 74 file {'/etc/ssh/ssh_known_hosts':
97 ensure => 'present', 75 ensure => 'present',
98 mode => 0644, 76 mode => 0644,
99 } 77 }
100 78
101 # Work around https://issues.adblockplus.org/ticket/3479 79 # Work around https://issues.adblockplus.org/ticket/3479
102 if $::environment == 'development' { 80 if $::environment == 'development' {
103 81
104 file { 82 file {
105 '/etc/ssh/ssh_host_rsa_key': 83 '/etc/ssh/ssh_host_rsa_key':
106 source => 'puppet:///modules/base/development_host_rsa_key', 84 source => 'puppet:///modules/base/development_host_rsa_key',
107 mode => 600, 85 mode => 600,
108 notify => Service['ssh']; 86 notify => Service['ssh'];
109 '/etc/ssh/ssh_host_rsa_key.pub': 87 '/etc/ssh/ssh_host_rsa_key.pub':
110 source => 'puppet:///modules/base/development_host_rsa_key.pub', 88 source => 'puppet:///modules/base/development_host_rsa_key.pub',
111 mode => 644; 89 mode => 644;
112 } 90 }
113 } 91 }
114 } 92 }
OLDNEW
« no previous file with comments | « modules/adblockplus/manifests/init.pp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld