# Puppet Class: puppet_cd::r10k::webhook

Inherits:
  puppet_cd::params

Defined in:
  manifests/r10k/webhook.pp

## Summary

Class manages r10k webhook settings for the puppet_cd module.

## Overview

puppet_cd::r10k::webhook.pp Module name: puppet_cd Author: Arne Teuke (arne_teuke@confdroid)

    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

    # File 'manifests/r10k/webhook.pp', line 6

    class puppet_cd::r10k::webhook (

    ) inherits puppet_cd::params {
      if ($pt_pm_fqdn == $fqdn) and ($pt_use_r10k_webhook == true) {
        # create the webhook binary
        file { $pt_r10k_hook_file:
          ensure   => file,
          owner    => 'root',
          group    => 'root',
          mode     => '0755',
          selrange => s0,
          selrole  => object_r,
          seltype  => bin_t,
          seluser  => unconfined_u,
          source   => 'puppet:///modules/puppet_cd/webhook',
        }

        # create the webhook config dir
        file { $pt_r10k_webhook_dir:
          ensure   => directory,
          owner    => 'root',
          group    => 'root',
          mode     => '0755',
          selrange => s0,
          selrole  => object_r,
          seltype  => etc_t,
          seluser  => system_u,
        }

        # create webhook config
        file { $pt_r10k_hook_config_file:
          owner    => 'root',
          group    => 'root',
          mode     => '0644',
          selrange => s0,
          selrole  => object_r,
          seltype  => etc_t,
          seluser  => system_u,
          content  => template($pt_r10k_hook_config_erb),
          notify   => Service['webhook'],
        }

        # create service config
        file { $pt_r10k_hook_service_file:
          owner    => 'root',
          group    => 'root',
          mode     => '0644',
          selrange => s0,
          selrole  => object_r,
          seltype  => systemd_unit_file_t,
          seluser  => system_u,
          content  => template($pt_r10k_hook_service_erb),
          notify   => Service['webhook'],
        }

        # manage service
        service { 'webhook':
          ensure     => 'running',
          hasstatus  => true,
          hasrestart => true,
          enable     => true,
        }
      }
    }