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

Unified Diff: modules/base/manifests/init.pp

Issue 29341151: Issue 4019 - Added "Edge" to platform choices in Issues tracker at issues1. (Closed)
Patch Set: Created May 10, 2016, 3:35 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « modules/base/files/development_host_rsa_key.pub ('k') | modules/downloadserver/files/site.conf » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/base/manifests/init.pp
===================================================================
--- a/modules/base/manifests/init.pp
+++ b/modules/base/manifests/init.pp
@@ -1,4 +1,49 @@
class base ($zone='adblockplus.org') {
+ stage {'pre': before => Stage['main']}
+ stage {'post': require => Stage['main']}
+
+ class {'users':
+ stage => 'pre',
+ }
+
+ if !defined(Class['apt']) {
+ class {'apt':
+ always_apt_update => true
+ }
+ }
+
+ # Note that APT dependencies are excluded here!
+ Exec['apt_update'] -> Package <|title != 'python-software-properties'|>
+
+ include postfix, ssh
+
+ package {['mercurial', 'vim', 'emacs', 'debian-goodies', 'htop']:
+ ensure => present,
+ }
+
+ file {'/etc/timezone':
+ ensure => file,
+ owner => root,
+ group => root,
+ mode => 0644,
+ content => 'UTC',
+ notify => Service['cron']
+ }
+
+ file {'/etc/localtime':
+ ensure => link,
+ target => '/usr/share/zoneinfo/UTC',
+ notify => Service['cron']
+ }
+
+ service {'cron':
+ ensure => running,
+ enable => true,
+ }
+
+ class {'logrotate':
+ stage => 'post'
+ }
$servers = hiera('servers')
create_resources(base::explicit_host_record, $servers)
@@ -11,34 +56,59 @@
$groups = undef,
) {
- $fqdn = $dns ? {
- undef => "$name.${base::zone}",
- default => $dns,
+ if is_array($ip) {
+ $internal_ip = $ip[0]
+ } else {
+ $internal_ip = $ip
}
- $ips = is_array($ip) ? {
- true => $ip,
- default => [$ip],
+ $fqdn_name = join([$name, $base::zone], '.')
+
+ host{$name:
+ ensure => present,
+ ip => $internal_ip,
+ name => $fqdn_name,
+ host_aliases => $dns ? {
+ undef => [],
+ default => $dns,
+ }
}
- $public_key = $ssh_public_key ? {
- undef => undef,
- default => "ssh-rsa $ssh_public_key $fqdn",
+ if $ssh_public_key != undef {
+
+ $name_key = $dns ? {
+ undef => $fqdn_name,
+ default => $dns,
+ }
+
+ @sshkey {$name:
+ name => $name_key,
+ key => $ssh_public_key,
+ type => ssh-rsa,
+ host_aliases => $ip,
+ tag => 'base::explicit_host_record',
+ }
}
+ }
- adblockplus::host {$title:
- fqdn => $fqdn,
- groups => $groups,
- ips => $ips,
- name => $name,
- role => $role,
- public_key => $public_key,
+ # Work around https://projects.puppetlabs.com/issues/4145
+ Sshkey<| |> ->
+ file {'/etc/ssh/ssh_known_hosts':
+ ensure => 'present',
+ mode => 0644,
+ }
+
+ # Work around https://issues.adblockplus.org/ticket/3479
+ if $::environment == 'development' {
+
+ file {
+ '/etc/ssh/ssh_host_rsa_key':
+ source => 'puppet:///modules/base/development_host_rsa_key',
+ mode => 600,
+ notify => Service['ssh'];
+ '/etc/ssh/ssh_host_rsa_key.pub':
+ source => 'puppet:///modules/base/development_host_rsa_key.pub',
+ mode => 644;
}
-
- # Implicit realization behavior has been introduced by accident in a
- # previous version, hence it should be kept until class base is obsolete
- # and the obsolete records have been removed
- realize(Host[$title])
- realize(Sshkey[$title])
}
}
« no previous file with comments | « modules/base/files/development_host_rsa_key.pub ('k') | modules/downloadserver/files/site.conf » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld