Puppet Class: gitlabr10khook::install

Inherits:
gitlabr10khook
Defined in:
manifests/install.pp

Overview

Class: gitlabr10khook::install vim: set softtabstop=2 ts=2 sw=2 expandtab:

This configures the gitlab-puppet-webhook that will take webhook triggers from gitlab and run r10k on your puppet server it currently only supports the PUSH mechanism

Authors


Karl Vollmer <karl.vollmer@gmail.com> Copyright


Copyright 2016 Karl Vollmer



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
# File 'manifests/install.pp', line 15

class gitlabr10khook::install inherits gitlabr10khook {

  # We're going to need OpenSSL and various other Python packages
  # For now we're going to assume they got them all, needs to be
  # Corrected, and allow for different OS's
  ensure_packages(['python-devel','python','gcc','git','openssl'],{'ensure'=>'present'})

  ## Checkout the Gitlab Puppet webhook
  exec { 'gitlabr10khook-checkout-from-gitlab':
    command => "git clone --branch ${gitlabr10khook::release} https://github.com/vollmerk/gitlab-puppet-webhook.git ${gitlabr10khook::install}",
    user    => 'root',
    require => Package['git'],
    creates => $gitlabr10khook::install,
    notify  => Exec['gitlabr10khook-update-python-daemon'],
  }

  exec { 'gitlabr10khook-pip':
    command     => 'easy_install pip',
    user        => 'root',
    require     => Package['python'],
    refreshonly => true,
  }

  ## Upgrade Python-Daemon so it works
  exec { 'gitlabr10khook-update-python-daemon':
    command     => 'pip install --upgrade python-daemon',
    user        => 'root',
    require     => Exec['gitlabr10khook-pip'],
    refreshonly => true,
    notify      => Exec['gitlabr10khook-slackweb'],
  }

  exec { 'gitlabr10khook-slackweb':
    command     => 'pip install slackweb',
    user        => 'root',
    require     => Exec['gitlabr10khook-pip'],
    refreshonly => true,
    notify      => Exec['gitlabr10khook-psutil'],
  }

  # PSutil requires gcc to compile, so we have to require that package
  exec { 'gitlabr10khook-psutil':
    command     => 'pip install psutil',
    user        => 'root',
    require     => [Exec['gitlabr10khook-pip'],Package['gcc']],
    refreshonly => true,
  }

  ## Make sure we've checked out the specified release
  exec { 'gitlabr10khook-checkout-tag-from-gitlab':
    command => "git checkout master;git fetch;git checkout tags/${gitlabr10khook::release}",
    cwd     => $gitlabr10khook::install,
    user    => 'root',
    require => Exec['gitlabr10khook-checkout-from-gitlab'],
    unless  => "git name-rev --tags --name-only $(git rev-parse HEAD) | grep ${gitlabr10khook::release}",
  }
}