├── .gitignore ├── files ├── Gemfile ├── webhook_config.json ├── config.ru └── Gemfile.lock ├── templates ├── webhook_config.json.erb ├── service.debian.erb ├── webhook.rb └── service.redhat.erb ├── manifests ├── params.pp └── init.pp ├── CHANGELOG.md ├── metadata.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .*.sw? 2 | pkg 3 | spec/fixtures 4 | .vagrant 5 | log 6 | 7 | -------------------------------------------------------------------------------- /files/Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | gem 'json' 4 | gem 'thin' 5 | gem 'sinatra' 6 | gem 'rack' 7 | 8 | -------------------------------------------------------------------------------- /files/webhook_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "r10k_cmd": "/usr/bin/r10k", 3 | "mco": false, 4 | "mco_cmd": "/usr/bin/mco r10k", 5 | "mco_user": "mcollective-user" 6 | } 7 | -------------------------------------------------------------------------------- /templates/webhook_config.json.erb: -------------------------------------------------------------------------------- 1 | { 2 | "r10k_cmd": "/usr/bin/r10k", 3 | "mco": <%= @mco %>, 4 | "mco_cmd": "/usr/bin/mco r10k", 5 | "mco_user": "<%= @mco_user %>" 6 | } 7 | -------------------------------------------------------------------------------- /files/config.ru: -------------------------------------------------------------------------------- 1 | require './webhook' 2 | 3 | #set :environment, :production 4 | 5 | log = File.new("log/sinatra.log", "a") 6 | log.sync = true 7 | $stdout.reopen(log) 8 | $stderr.reopen(log) 9 | 10 | run Sinatra::Application 11 | 12 | -------------------------------------------------------------------------------- /files/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | daemons (1.1.9) 5 | eventmachine (1.0.3) 6 | json (1.8.1) 7 | rack (1.5.2) 8 | rack-protection (1.5.3) 9 | rack 10 | sinatra (1.4.5) 11 | rack (~> 1.4) 12 | rack-protection (~> 1.4) 13 | tilt (~> 1.3, >= 1.3.4) 14 | thin (1.6.2) 15 | daemons (>= 1.0.9) 16 | eventmachine (>= 1.0.0) 17 | rack (>= 1.0.0) 18 | tilt (1.4.1) 19 | 20 | PLATFORMS 21 | ruby 22 | 23 | DEPENDENCIES 24 | json 25 | rack 26 | sinatra 27 | thin 28 | -------------------------------------------------------------------------------- /manifests/params.pp: -------------------------------------------------------------------------------- 1 | # class: webhook::params 2 | # 3 | # this class manages webhook puppet parameters 4 | # 5 | # parameters: 6 | # 7 | # actions: 8 | # 9 | # requires: 10 | # 11 | # sample usage: 12 | # 13 | class webhook::params { 14 | 15 | $homedir = '/opt/webhook' 16 | $port = '81' 17 | $owner = 'root' 18 | $group = 'root' 19 | $mco = 'false' # Important, since we are writing to a json file and Json only do lowercase boolean. 20 | $mco_user = 'mcollective-user' # the user being utilized to invoke mco r10k 21 | 22 | # OS specific stuff 23 | if $::osfamily == 'RedHat' { 24 | $ruby_dev = 'ruby-devel' 25 | } elsif $::osfamily == 'Debian' { 26 | $ruby_dev = 'ruby-dev' 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | #wdijkerman-webhook release 2 | # Change log file 3 | Below an overview of all changes in the releases. 4 | 5 | # lots of stuff 6 | 7 | 0.1.0 8 | 9 | * Bug with init script, osfamily 10 | * Added MCO Support, fixed a number of bugs #4 (By pull request: rilindo (Thanks!)) 11 | * Fix os family init scope #3 (By pull request: rilindo (Thanks!)) 12 | 13 | Version (Release date) 14 | 15 | 0.0.3 (2014-08-28) 16 | 17 | * Small bug fix. Not recognize repo_name. If statement went alway into "else". 18 | 19 | 0.0.2 (2014-08-20) 20 | 21 | * Package ruby-devel not available on Ubuntu. Fixed. 22 | * Added correct init script for debian/ubuntu systems. 23 | 24 | 0.0.1 (2014-08-01) 25 | 26 | * Initial working version. 27 | -------------------------------------------------------------------------------- /metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "requirements": [ 3 | { 4 | "name": "puppet", 5 | "version_requirement": "3.x" 6 | } 7 | ], 8 | "name": "wdijkerman-webhook", 9 | "version": "0.1.0", 10 | "summary": "Installing simple sinatra webhook for git pushes.", 11 | "author": "Werner Dijkerman", 12 | "description": "This will install an basic sinatra webapp which will be listening for JSON post information when something is pushed to an central git repository. You will need to configure this instance yourself by setting an webhook for every repository. When correct url is provided and information is pushed to this central server, it will send JSON information to this server and it will execute an r10k call. Puppet modules or environments will be created or updated.", 13 | "dependencies": [ 14 | { 15 | "name": "ploperations/bundler", 16 | "version_requirement": ">= 1.0.0" 17 | } 18 | ], 19 | "source": "https://github.com/dj-wasabi/puppet-webhook.git", 20 | "project_page": "http://forge.puppetlabs.com/wdijkerman/webhook", 21 | "license": "Apache Version 2.0", 22 | "operatingsystem_support": [ 23 | { 24 | "operatingsystem":"RedHat", 25 | "operatingsystemrelease":[ "5.0", "6.0" ] 26 | }, 27 | { 28 | "operatingsystem":"OracleLinux", 29 | "operatingsystemrelease":[ "5.0", "6.0" ] 30 | }, 31 | { 32 | "operatingsystem":"Scientific", 33 | "operatingsystemrelease":[ "5.0", "6.0" ] 34 | }, 35 | { 36 | "operatingsystem":"CentOS", 37 | "operatingsystemrelease":[ "5.0", "6.0" ] 38 | }, 39 | { 40 | "operatingsystem":"Debian", 41 | "operatingsystemrelease":[ "6.0", "7.0" ] 42 | } 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /templates/service.debian.erb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: webhook 4 | # Required-Start: $local_fs $network $named $time $syslog 5 | # Required-Stop: $local_fs $network $named $time $syslog 6 | # Default-Start: 2 3 4 5 7 | # Default-Stop: 0 1 6 8 | # Description: This will start an Sinatra webhook via thin 9 | ### END INIT INFO 10 | 11 | WEBHOOK_HOME=<%= @webhook_home %> 12 | WEBHOOK_PORT=<%= @webhook_port %> 13 | WEBHOOK_LOG="/var/log/webhook_thin.log" 14 | WEBHOOK_PID="/var/run/webhook_thin.pid" 15 | RUBY_SMALL=$(facter rubyversion | cut -c1-3) 16 | GEM_HOME="<%= @webhook_home %>/vendor/bundle/ruby/${RUBY_SMALL}/gems" 17 | GEM_PATH="<%= @webhook_home %>/vendor/bundle/ruby/${RUBY_SMALL}" 18 | PATH="${PATH}:${GEM_PATH}/bin" 19 | 20 | SCRIPT="thin start --environment production --port ${WEBHOOK_PORT} -P ${WEBHOOK_PID} -l ${WEBHOOK_LOG} -c ${WEBHOOK_HOME} -d -q" 21 | RUNAS=<%= @webhook_user %> 22 | 23 | PIDFILE=/var/run/webhook.pid 24 | LOGFILE=/var/log/webhook.log 25 | 26 | start() { 27 | if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then 28 | echo 'Service already running' >&2 29 | return 1 30 | fi 31 | echo 'Starting service…' >&2 32 | local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" 33 | su -c "$CMD" $RUNAS > "$PIDFILE" 34 | echo 'Service started' >&2 35 | } 36 | 37 | stop() { 38 | if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then 39 | echo 'Service not running' >&2 40 | return 1 41 | fi 42 | echo 'Stopping service…' >&2 43 | kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" 44 | echo 'Service stopped' >&2 45 | } 46 | 47 | uninstall() { 48 | echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] " 49 | local SURE 50 | read SURE 51 | if [ "$SURE" = "yes" ]; then 52 | stop 53 | rm -f "$PIDFILE" 54 | echo "Notice: log file is not be removed: '$LOGFILE'" >&2 55 | update-rc.d -f remove 56 | rm -fv "$0" 57 | fi 58 | } 59 | 60 | case "$1" in 61 | start) 62 | start 63 | ;; 64 | stop) 65 | stop 66 | ;; 67 | uninstall) 68 | uninstall 69 | ;; 70 | retart) 71 | stop 72 | start 73 | ;; 74 | *) 75 | echo "Usage: $0 {start|stop|restart|uninstall}" 76 | esac 77 | 78 | -------------------------------------------------------------------------------- /templates/webhook.rb: -------------------------------------------------------------------------------- 1 | require 'sinatra' 2 | require 'json' 3 | 4 | # User customization 5 | repo_puppetfile = "<%= @repo_puppetfile %>" 6 | <% if @repo_hieradata -%> 7 | repo_hierdata = "<%= @repo_hieradata %>" 8 | <% end -%> 9 | 10 | webhook_config_obj = JSON.parse(File.read((Dir.pwd) + "/webhook_config.json")) 11 | 12 | post '/payload' do 13 | push = JSON.parse(request.body.read) 14 | logger.info("json payload: #{push.inspect}") 15 | 16 | repo_name = push['repository']['name'] 17 | repo_ref = push['ref'] 18 | ref_array = repo_ref.split("/") 19 | ref_type = ref_array[1] 20 | branchName = ref_array[2] 21 | logger.info("repo name = #{repo_name}") 22 | logger.info("repo ref = #{repo_ref}") 23 | logger.info("branch = #{branchName}") 24 | 25 | # Check if repo_name is 'puppetfile' 26 | if repo_name == repo_puppetfile <% if @repo_hieradata %>|| repo_name == repo_hieradata <% end %> 27 | logger.info("Deploy r10k for this environment #{branchName}") 28 | deployEnv(branchName,webhook_config_obj) 29 | else 30 | module_name = repo_name.split('-').pop 31 | logger.info("Deploy puppet module #{module_name}") 32 | logger.info("Running for branch #{branchName}") 33 | deployModule(module_name,webhook_config_obj) 34 | end 35 | end 36 | 37 | # Some defines. 38 | def deployEnv(branchname,cmd_obj) 39 | if cmd_obj['mco'] # Check to see if we are using mco 40 | if cmd_obj['mco_user'] # run it as a mco user if specified 41 | deployCmd = "/bin/su #{cmd_obj['mco_user']} -c '#{cmd_obj['mco_cmd']} deploy #{branchname}'" 42 | else # if we are running mco as root 43 | deployCmd = "#{cmd_obj['mco_user']} #{cmd_obj['mco_cmd']} deploy #{branchname}" 44 | end 45 | else # use deefaults 46 | deployCmd = "#{cmd_obj['r10k_cmd']} deploy environment #{branchname} -pv" 47 | end 48 | logger.info("Now running #{deployCmd}") 49 | `#{deployCmd}` 50 | end 51 | 52 | def deployModule(modulename,cmd_obj) 53 | if cmd_obj['mco'] # Check to see if we are using mco 54 | if cmd_obj['mco_user'] # run it as a mco user if specified 55 | deployCmd = "/bin/su #{cmd_obj['mco_user']} -c '#{cmd_obj['mco_cmd']} deploy_module #{modulename}'" 56 | else 57 | deployCmd = "#{cmd_obj['mco_user']} #{cmd_obj['mco_cmd']} deploy_module #{modulename}" 58 | end 59 | else # use defaults 60 | deployCmd = "#{cmd_obj['r10k_cmd']} deploy module #{modulename} -v" 61 | end 62 | logger.info("Now running #{deployCmd}") 63 | `#{deployCmd}` 64 | end 65 | -------------------------------------------------------------------------------- /templates/service.redhat.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Daemon Name: webhook 4 | # 5 | # chkconfig: - 58 74 6 | # description: This will start an Sinatra webhook via thin 7 | # 8 | 9 | # Sourcing the linux functions file 10 | source /etc/init.d/functions 11 | 12 | # Set some variables 13 | WEBHOOK_HOME=<%= @webhook_home %> 14 | WEBHOOK_PORT=<%= @webhook_port %> 15 | WEBHOOK_LOG="/var/log/webhook.log" 16 | WEBHOOK_PID="/var/run/webhook_thin.pid" 17 | INIT_PID="/var/run/webhook.pid" 18 | LOCKFILE="/var/lock/subsys/webhook" 19 | RUBY_SMALL=$(facter rubyversion | cut -c1-3) 20 | GEM_HOME="<%= @webhook_home %>/vendor/bundle/ruby/${RUBY_SMALL}/gems" 21 | GEM_PATH="<%= @webhook_home %>/vendor/bundle/ruby/${RUBY_SMALL}" 22 | PATH="${PATH}:${GEM_PATH}/bin" 23 | 24 | # These are our own functions for this script. 25 | start() { 26 | # Start our daemon 27 | echo -n "Starting webhook: " 28 | thin start --environment production --port ${WEBHOOK_PORT} -P ${WEBHOOK_PID} -l ${WEBHOOK_LOG} -c ${WEBHOOK_HOME} -d -q 29 | RETVAL=$? 30 | 31 | #If all is well touch the lock file 32 | [ $RETVAL -eq 0 ] && touch ${LOCKFILE} 33 | success 34 | echo 35 | 36 | PID_NUM=$(ps -ef | grep 'thin server' | grep ${WEBHOOK_PORT} | grep -v grep | awk '{print $2}') 37 | echo ${PID_NUM} > ${INIT_PID} 38 | return $RETVAL 39 | } 40 | 41 | stop() { 42 | # First get if pid file exists. If so, we can assume the app is still working. 43 | if [ -f ${INIT_PID} ] 44 | then PID_NUM=$(cat ${INIT_PID}) 45 | else PID_NUM=$(ps -ef | grep 'thin server' | grep ${WEBHOOK_PORT} | grep -v grep | awk '{print $2}') 46 | # So check if we have an pid. Maybe the pid file was not removed when stopping (Or killing) 47 | if [[ ${PID_NUM} == '' ]] 48 | then echo "Is already stopped." 49 | # When the application is already stopped and we execute an "restart", don't exit because 50 | # the app is stopped. Otherwise just exit. 51 | if [[ $1 != "restart" ]] 52 | then exit 0 53 | fi 54 | fi 55 | fi 56 | 57 | # So if PID_NUM is something else than '' (Nothing) we can stop thin 58 | # Otherwise we have an ruby stacktrace (ugly). 59 | if [[ ${PID_NUM} != '' ]] 60 | then echo -n "Stopping webhook: " 61 | thin stop -P ${WEBHOOK_PID} -q 62 | RETVAL=$? 63 | 64 | if [[ ${RETVAL} == 0 ]] 65 | then success 66 | rm -f ${LOCKFILE} ${INIT_PID} 67 | else failure 68 | fi 69 | echo 70 | return $RETVAL 71 | 72 | fi 73 | } 74 | 75 | # This is the case 76 | case "$1" in 77 | start) 78 | start 79 | ;; 80 | stop) 81 | stop 82 | ;; 83 | restart) 84 | stop restart 85 | start 86 | ;; 87 | status) 88 | status webhook 89 | ;; 90 | *) 91 | 92 | '' 93 | esac 94 | 95 | exit ${RETVAL} 96 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #puppet-webhook 2 | 3 | ####Table of Contents 4 | 5 | 1. [Description](#description) 6 | 1.[Github](#github.com) 7 | 2.[Gitlab](#gitlab) 8 | 2. [How to use](#how-to-use) 9 | 3. [OS Support](#support) 10 | 4. [Todo](#todo) 11 | 12 | 13 | ##Description 14 | 15 | This module will install an simple but basic sinatra webapp which we be executing r10k commands when something is posted to this site. When something is pushed to an git repository, you can configure it by executing so-called webhooks. 16 | 17 | ###Github.com 18 | When using github for example, within the settings of the repository there is an setting called "Webhooks & Services". Fill in the webadress in the "Payload url" and make sure that "application/json" (Which is default) is selected. Also select "Just the push event." and click on "Add webhook". 19 | 20 | Please be sure, that github.com needs to be able to access this webpage. So configure the firewall for your devices to make sure it is accessible from github.com 21 | 22 | ###gitlab 23 | When using the (standalone) gitlab, you'll need to go to the "settings" page of every repository. You'll find on the left side of the page the "Web Hooks". When page opens, you'll need to provide the correct url into "URL" field and select "Push events". After this, click on the "Add Web Hook" button. 24 | 25 | Please be sure, that gitlab.org needs to be able to access this webpage. So configure the firewall for your devices to make sure it is accessible from gitlab.org 26 | 27 | ##How to use 28 | 29 | Basic usage 30 | 31 | ```ruby 32 | class { 'webhook': } 33 | ``` 34 | 35 | This will install an basic webapp which will be running as user root on port 81. The sinatra app is only available when one "JSON" information is posted to "http://fqdn:81/payload". The port can be overriden using the "webhook_port" parameter. 36 | 37 | You can override this module with the following parameters: 38 | 39 | * `webhook_home`: As default, this will be installed on '/opt/webhook'. You can override it by setting an different value 40 | * `webhook_port`: On which port it is listening for requests. Default it will run on port 81. You can use this to any other port. When changing the port higher than 1023, this app still runs as root. (See todo) 41 | * `webhook_owner`: The owner of this service/script. Default it has 'root' as owner. 42 | * `webhook_group`: The group of this service/script. Default it is set to 'root'. 43 | * `repo_puppetfile`: The name of the repository where the 'Puppetfile' is stored. Default is 'undef' but this one needs to be supplied when you want this to work correctly. 44 | * `repo_hieradata`: The name of the repository where the 'hieradata' is stored. Default is 'undef' as not everyone is using hiera. 45 | * `ruby_dev`: The ruby dev package. RH: ruby-devel, Debian: ruby-dev 46 | 47 | ##Support 48 | 49 | The module is only supported on: 50 | 51 | - CentOS 6 52 | - Debian 7 53 | - OracleLinux 6 54 | 55 | ##Todo 56 | The following is an overview of todo actions: 57 | 58 | - When running on port >1023, it should not run as root, but as specified webhook_user 59 | - Create rspec tests 60 | - Better documentation 61 | - Probably a lot ;-) 62 | 63 | Please send me suggestions! 64 | 65 | 66 | -------------------------------------------------------------------------------- /manifests/init.pp: -------------------------------------------------------------------------------- 1 | # == Class: webook 2 | # 3 | # This will install and configure the webhook for git webhooks 4 | # so it will run an r10k deploy * action 5 | # 6 | # === Requirements 7 | # 8 | # No requirements. 9 | # 10 | # - puppetlabs-operations/puppet-bundler 11 | # 12 | # === Parameters 13 | # 14 | # [*webhook_home*] 15 | # This is the directory where all stuff of 16 | # this webhook is installed 17 | # 18 | # [*webhook_port*] 19 | # On which port it is listening for requests 20 | # 21 | # [*webhook_owner*] 22 | # The owner of this service/script 23 | # 24 | # [*webhook_group*] 25 | # The group of this service/script 26 | # 27 | # [*repo_puppetfile*] 28 | # The name of the repository where the 'Puppetfile' 29 | # is stored. 30 | # 31 | # [*repo_hieradata*] 32 | # The name of the repository where the 'hieradata' 33 | # is stored. 34 | # 35 | # [*ruby_dev*] 36 | # The package name of ruby-devel (or when debian: ruby-dev) 37 | # 38 | # [*mco*] 39 | # Enables mco. Defaults to false (lowercase). See params.pp for explanation. 40 | # [*mco_user*] 41 | # The user being utilized to invoke mco r10k. Defaults to mcollective-user 42 | # 43 | # === Example 44 | # 45 | # class { 'webhook': 46 | # webhook_port => '82', 47 | # repo_puppetfile => "puppetfilerepo", 48 | # repo_hieradata => "puppethieradata", 49 | # } 50 | # 51 | # === Authors 52 | # 53 | # Author Name: ikben@werner-dijkerman.nl 54 | # 55 | # === Copyright 56 | # 57 | # Copyright 2014 Werner Dijkerman 58 | # 59 | class webhook ( 60 | $webhook_home = $webhook::params::homedir, 61 | $webhook_port = $webhook::params::port, 62 | $webhook_owner = $webhook::params::owner, 63 | $webhook_group = $webhook::params::group, 64 | $mco = $webhook::params::mco, 65 | $mco_user = $webhook::params::mco_user, 66 | $repo_puppetfile = undef, 67 | $repo_hieradata = undef, 68 | $ruby_dev = $webhook::params::ruby_dev, 69 | ) inherits webhook::params { 70 | 71 | $osfamily = inline_template('<%= osfamily.downcase %>') 72 | 73 | exec { 'create_webhook_homedir': 74 | command => "mkdir -p ${webhook_home}", 75 | path => '/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin', 76 | creates => $webhook_home, 77 | } 78 | 79 | file { "${webhook_home}/config.ru": 80 | ensure => present, 81 | owner => $webhook_owner, 82 | group => $webhook_group, 83 | mode => '0755', 84 | source => 'puppet:///modules/webhook/config.ru', 85 | require => Exec['create_webhook_homedir'], 86 | } 87 | 88 | file { "${webhook_home}/webhook_config.json": 89 | ensure => present, 90 | owner => $webhook_owner, 91 | group => $webhook_group, 92 | mode => '0644', 93 | content => template('webhook/webhook_config.json.erb'), 94 | require => Exec['create_webhook_homedir'], 95 | notify => Service['webhook'], 96 | } 97 | 98 | file { "${webhook_home}/Gemfile": 99 | ensure => present, 100 | owner => $webhook_owner, 101 | group => $webhook_group, 102 | mode => '0755', 103 | source => 'puppet:///modules/webhook/Gemfile', 104 | #notify => Bundler::Install[$webhook_home], 105 | require => Exec['create_webhook_homedir'], 106 | } 107 | 108 | file { "${webhook_home}/Gemfile.lock": 109 | ensure => present, 110 | owner => $webhook_owner, 111 | group => $webhook_group, 112 | mode => '0755', 113 | source => 'puppet:///modules/webhook/Gemfile.lock', 114 | #notify => Bundler::Install[$webhook_home], 115 | require => Exec['create_webhook_homedir'], 116 | } 117 | 118 | file { "${webhook_home}/log": 119 | ensure => directory, 120 | owner => $webhook_owner, 121 | group => $webhook_group, 122 | mode => '0755', 123 | require => Exec['create_webhook_homedir'], 124 | } 125 | 126 | file { "${webhook_home}/webhook.rb": 127 | ensure => present, 128 | owner => $webhook_owner, 129 | group => $webhook_group, 130 | mode => '0755', 131 | require => Exec['create_webhook_homedir'], 132 | content => template('webhook/webhook.rb'), 133 | notify => Service['webhook'], 134 | } 135 | 136 | file { '/etc/init.d/webhook': 137 | ensure => present, 138 | mode => '0775', 139 | content => template("webhook/service.${osfamily}.erb"), 140 | } 141 | 142 | if ! defined(Package[$ruby_dev]) { 143 | package { $ruby_dev: 144 | ensure => 'installed', 145 | } 146 | } 147 | 148 | bundler::install { $webhook_home: 149 | user => $webhook_owner, 150 | group => $webhook_group, 151 | deployment => false, 152 | without => 'development test doc', 153 | require => [ 154 | File["${webhook_home}/config.ru"], 155 | File["${webhook_home}/Gemfile"], 156 | File["${webhook_home}/Gemfile.lock"], 157 | Package[$ruby_dev], 158 | ], 159 | } 160 | 161 | service { 'webhook': 162 | ensure => running, 163 | hasstatus => true, 164 | enable => true, 165 | hasrestart => true, 166 | require => [ 167 | Bundler::Install[$webhook_home], 168 | File["${webhook_home}/webhook.rb"], 169 | ], 170 | } 171 | } 172 | 173 | --------------------------------------------------------------------------------