Puppet Class: stash::install
- Defined in:
- manifests/install.pp
Overview
Class: stash::install
This installs the stash module. See README.md for details
5 6 7 8 9 10 11 12 13 14 15 16 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 |
# File 'manifests/install.pp', line 5
class stash::install(
$version = $stash::version,
$product = $stash::product,
$format = $stash::format,
$installdir = $stash::installdir,
$homedir = $stash::homedir,
$user = $stash::user,
$group = $stash::group,
$uid = $stash::uid,
$gid = $stash::gid,
$git_version = $stash::git_version,
$repoforge = $stash::repoforge,
$downloadURL = $stash::downloadURL,
$s_or_d = $stash::staging_or_deploy,
$webappdir
) {
case $::osfamily {
'redhat': {
$initscript_template = 'stash/stash.initscript.redhat.erb'
validate_bool($repoforge)
# If repoforge is not enabled by default, enable it
# but only allow git to be installed from it.
if ! defined(Class['repoforge']) and $repoforge {
class { 'repoforge':
enabled => [ 'extras', ],
includepkgs => {
'extras' => 'git,perl-Git'
},
before => Package['git']
} ~>
exec { "${stash::product}_clean_yum_metadata":
command => '/usr/bin/yum clean metadata',
refreshonly => true
} ~>
# Git may already have been installed, so lets update it to a
# supported version.
exec { "${stash::product}_upgrade_git":
command => '/usr/bin/yum -y upgrade git',
onlyif => '/bin/rpm -qa git',
refreshonly => true,
}
}
}
'debian': {
$initscript_template = 'stash/stash.initscript.debian.erb'
}
default: {
fail("Class['stash::install']: Unsupported osfamily: ${::osfamily}")
}
}
if ! defined(Package['git']) {
package { 'git':
ensure => $git_version,
}
}
group { $group:
ensure => present,
gid => $gid
} ->
user { $user:
comment => 'Stash daemon account',
shell => '/bin/bash',
home => $homedir,
password => '*',
password_min_age => '0',
password_max_age => '99999',
managehome => true,
uid => $uid,
gid => $gid,
}
if ! defined(File[$installdir]) {
file { $installdir:
ensure => 'directory',
owner => $user,
group => $group,
}
}
# Deploy files using either staging or deploy modules.
$file = "atlassian-${product}-${version}.${format}"
case $s_or_d {
'staging': {
require staging
if ! defined(File[$webappdir]) {
file { $webappdir:
ensure => 'directory',
owner => $user,
group => $group,
}
}
staging::file { $file:
source => "${downloadURL}/${file}",
timeout => 1800,
} ->
staging::extract { $file:
target => $webappdir,
creates => "${webappdir}/conf",
strip => 1,
user => $user,
group => $group,
notify => Exec["chown_${webappdir}"],
before => File[$homedir],
require => [
File[$installdir],
User[$user],
File[$webappdir] ],
}
}
'deploy': {
deploy::file { "atlassian-${product}-${version}.${format}":
target => $webappdir,
url => $downloadURL,
strip => true,
owner => $user,
group => $group,
download_timout => 1800,
notify => Exec["chown_${webappdir}"],
before => File[$homedir],
require => [ File[$installdir], User[$user] ]
}
}
default: {
fail('staging_or_deploy parameter must equal "staging" or "deploy"')
}
}
file { $homedir:
ensure => 'directory',
owner => $user,
group => $group,
require => User[$user],
} ->
exec { "chown_${webappdir}":
command => "/bin/chown -R ${user}:${group} ${webappdir}",
refreshonly => true,
subscribe => User[$stash::user]
} ->
file { '/etc/init.d/stash':
content => template($initscript_template),
mode => '0755',
}
}
|