Puppet Class: tungsten::prereq

Inherits:
tungsten::params
Defined in:
manifests/prereq.pp

Overview

Parameters:

  • systemUserName (Any) (defaults to: $tungsten::params::systemUserName)
  • nodeHostName (Any) (defaults to: $fqdn)
  • installJava (Any) (defaults to: true)
  • installNTP (Any) (defaults to: $tungsten::params::installNTP)
  • disableFirewall (Any) (defaults to: true)
  • disableSELinux (Any) (defaults to: true)
  • replicatorRepo (Any) (defaults to: false)
  • installMysqlj (Any) (defaults to: true)
  • mysqljLocation (Any) (defaults to: false)
  • installSSHKeys (Any) (defaults to: false)
  • sshPublicKey (Any) (defaults to: $tungsten::params::defaultSSHPublicKey)
  • sshPrivateCert (Any) (defaults to: $tungsten::params::defaultSSHPrivateCert)
  • skipHostConfig (Any) (defaults to: false)
  • vmSwappiness (Any) (defaults to: 10)
  • docker (Any) (defaults to: false)
  • installGems (Any) (defaults to: true)
  • localGemLocation (Any) (defaults to: false)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'manifests/prereq.pp', line 17

class tungsten::prereq (
	$systemUserName 				        = $tungsten::params::systemUserName,
	$nodeHostName									  = $fqdn,
	$installJava									  = true,
	$installNTP										  = $tungsten::params::installNTP,
	$disableFirewall							  = true,
	$disableSELinux									= true,

	# This may be set to 'nightly', 'stable' or 'true
	# If set to 'true', the stable repository will be used
	$replicatorRepo							    = false,

	$installMysqlj								  = true,
    $mysqljLocation               = false,

  #Setting this to true should only be used to support
	#testing as it's not secure unless you specify a custom private key
	$installSSHKeys								  = false,
	  $sshPublicKey                 = $tungsten::params::defaultSSHPublicKey,
	  $sshPrivateCert               = $tungsten::params::defaultSSHPrivateCert,

  #If this is set to true no setting of hostname will be done
  $skipHostConfig                 = false,
	$vmSwappiness										= 10,
	$docker													= false,
	$installGems										= true,
	$localGemLocation								= false

) inherits tungsten::params {
	if ($operatingsystem =~ /(?i:debian|ubuntu)/) {
		class { 'apt':
			update => {
			   frequency => 'always',
			},
	  }  -> Package <| |>
	}

	define install_local_gems  ( $loc  = false ) {

		if $loc == false {
			fail "install local gems failed as it was not passed a location"
		}
		package { $name:
			provider => "gem",
			require  => File['/etc/gemrc'],
			source   => "$loc/$name",
	 }
	}

	package {'continuent-ruby': ensure => present, name => "ruby", }
	if ! defined(Package['continuent-wget']) {
			package {'continuent-wget': ensure => present, name => "wget", }
	}
	package {'continuent-sudo': ensure => present, name => "sudo", }
	if ! defined(Package['continuent-rsync']) {
		package {'continuent-rsync': ensure => present, name => "rsync", }
	}
  if $osfamily == 'RedHat' {
    package {'continuent-rubygems': ensure => present, name => "rubygems",}
  }

  if $osfamily == 'Debian' {
      #Newer releases have it built in so this should go away in the end
      if $operatingsystemrelease == '12.04' or
         $operatingsystemrelease == '10.04' or
         $lsbdistcodename == 'wheezy' or
         $lsbdistcodename == 'squeeze'{
          package {'continuent-rubygems': ensure => present, name => "rubygems",}
        }
  }

	if $installGems == true {
		package { "json_pure":
	     provider => "gem",
	  }

	  package { "continuent-monitors-nagios":
	     provider => "gem",
	     ensure => latest,
	  }
	}

	if $installGems == 'local' {

		if $localGemLocation == false {
			fail "If local install specified for gem a installGemLocation=> must be specified"
		}

			$localGemsToInstall=[
				"zip-2.0.2.gem",
				"xhr-ifconfig-1.2.3.gem",
				"open4-1.3.4.gem",
				"net-ssh-2.9.2.gem",
				"net-scp-1.2.1.gem",
				"escape-0.0.4.gem",
				"continuent-tools-core-0.11.0.gem",
				"continuent-tools-monitoring-0.7.0.gem",
				"json_pure-1.8.2.gem",
				"continuent-monitors-nagios-0.7.0.gem"]

			#If puppet is installing remotely if defaults to --no-ri --no-rdoc
			#for local gems it doesn't do this will set it
			file { "/etc/gemrc" :
				content => "gem: --no-rdoc --no-ri"
			} ->
			install_local_gems { $localGemsToInstall : loc=>$localGemLocation }

	}


	if $disableFirewall == true {
		class { "firewall": ensure    => stopped, }
		if $::osfamily == "RedHat" and  $::operatingsystemmajrelease == 7 {
		  if !defined(Service["firewalld"]) {
		    service {"firewalld": ensure => 'stopped'}
		  }
		}
	}

	if $skipHostConfig == false {
		class { "tungsten::prereq::hostname":
			nodeHostName                => $nodeHostName,
		}
	}

	class { "tungsten::prereq::unix_user":
		installSSHKeys                => $installSSHKeys,
		  sshPublicKey                => $sshPublicKey,
		  sshPrivateCert              => $sshPrivateCert,
	}

	anchor { "tungsten::prereq::start":
		require => [
			Package["continuent-wget"],
			Package["continuent-sudo"],
		]
	} ->
	class{ "tungsten::prereq::mysqlj":
		enabled => $installMysqlj,
    location => $mysqljLocation
	} ->
	class {"tungsten::prereq::sysctl":
		 vmSwappiness => $vmSwappiness,
		 docker 			=> $docker
	}->
	anchor { "tungsten::prereq::end":
		require => [
			Class["tungsten::prereq::unix_user"],
		]
	}

	if $installNTP == true {
		class { "ntp":
			before => Anchor["tungsten::prereq::start"]
		}
	}

	if $installJava == true {
	  # If we are installing on Amazon, the java install is simple. Otherwise,
	  # use the java class to choose the correct package name
		if $operatingsystem == "Amazon" {
			package { "java-1.7.0-openjdk":
				before => Anchor["tungsten::prereq::start"]
			}
		} else {
			class { "java":
				before => Anchor["tungsten::prereq::start"]
			}
		}
	}

	class{ "tungsten::prereq::repo":
		replicatorRepo                => $replicatorRepo,
	}
}