Puppet Class: hubot::config
- Defined in:
- manifests/config.pp
Overview
Class: hubot::config
Configures hubot Private class
Authors
-
Justin Lambert <jlambert@letsevenup.com>
Copyright
Copyright 2013 EvenUp.
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 |
# File 'manifests/config.pp', line 16
class hubot::config {
if $caller_module_name != $module_name {
fail("Use of private class ${name} by ${caller_module_name}")
}
$exports = $::hubot::env_export
$scripts = $::hubot::scripts
$external_scripts = $::hubot::external_scripts
$dependencies = $::hubot::dependencies
file { '/etc/init.d/hubot':
ensure => 'present',
owner => 'root',
group => 'root',
mode => '0555',
content => template('hubot/hubot.init.erb'),
notify => Class['hubot::service']
}
if $::hubot::git_source {
require 'git'
if !defined(File["${::hubot::root_dir}/.ssh"]) {
file { "${::hubot::root_dir}/.ssh":
ensure => 'directory',
owner => 'hubot',
group => 'hubot',
mode => '0700',
}
}
if !defined(File["${::hubot::root_dir}/.ssh/id_rsa"]) {
file { "${::hubot::root_dir}/.ssh/id_rsa":
ensure => 'file',
owner => 'hubot',
group => 'hubot',
mode => '0600',
content => $::hubot::ssh_privatekey,
source => $::hubot::ssh_privatekey_file,
}
}
if $::hubot::auto_accept_host_key {
file { "${::hubot::root_dir}/.ssh/config":
owner => 'hubot',
group => 'hubot',
mode => '0440',
content => "Host *\n\tStrictHostKeyChecking no\n",
}
}
# If your hubot config is stored in git (it is, right?), this will clone
# it to this machine. This assumes you have already accepted any ssh keys
# and access needed. Alternatively, most config can be done through puppet
vcsrepo { "${::hubot::root_dir}/${::hubot::bot_name}":
ensure => latest,
provider => git,
source => $::hubot::git_source,
user => 'hubot',
revision => 'master',
notify => Class['hubot::service'],
}
} else {
exec { 'Hubot init':
command => "hubot -c ${::hubot::bot_name}",
cwd => $::hubot::root_dir,
path => '/usr/bin',
unless => "test -d ${::hubot::root_dir}/${::hubot::bot_name}",
user => 'hubot',
group => 'hubot',
logoutput => 'on_failure',
}
file { "${::hubot::root_dir}/${::hubot::bot_name}/hubot.env":
ensure => 'present',
owner => 'hubot',
group => 'hubot',
mode => '0440',
content => template('hubot/hubot.env.erb'),
notify => Class['hubot::service'],
require => Exec['Hubot init'],
}
file { "${::hubot::root_dir}/${::hubot::bot_name}/hubot-scripts.json":
ensure => 'present',
owner => 'hubot',
group => 'hubot',
mode => '0444',
content => template('hubot/hubot-scripts.erb'),
notify => Class['hubot::service'],
require => Exec['Hubot init'],
}
file { "${::hubot::root_dir}/${::hubot::bot_name}/external-scripts.json":
ensure => 'present',
owner => 'hubot',
group => 'hubot',
mode => '0444',
content => template('hubot/external-scripts.erb'),
notify => Class['hubot::service'],
require => Exec['Hubot init'],
}
file { "${::hubot::root_dir}/${::hubot::bot_name}/package.json":
ensure => 'present',
owner => 'hubot',
group => 'hubot',
mode => '0444',
content => template('hubot/package.json.erb'),
notify => Class['hubot::service'],
require => Exec['Hubot init'],
}
}
}
|