diff --git a/REFERENCE.md b/REFERENCE.md index 4548f989..f9006cb2 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -17,9 +17,6 @@ * [`r10k::params`](#r10k--params): Reasonable defaults for all classes * [`r10k::postrun_command`](#r10k--postrun_command): This class will configure r10k to run as part of the masters agent run * [`r10k::prerun_command`](#r10k--prerun_command): This class will configure r10k to run as part of the masters agent run -* [`r10k::webhook`](#r10k--webhook): This class creates a github webhoook to allow curl style post-rec scripts -* [`r10k::webhook::config`](#r10k--webhook--config): == Class: r10k::webhook::config Set up the root r10k config file (/etc/webhook.yaml). === Authors Zack Smith -* [`r10k::webhook::package`](#r10k--webhook--package): Private class, do not include it directly. Installs the webhook packages ### Tasks @@ -827,634 +824,6 @@ Data type: `Enum['present', 'absent']` Default value: `'present'` -### `r10k::webhook` - -This class creates a github webhoook to allow curl style post-rec scripts - -#### Parameters - -The following parameters are available in the `r10k::webhook` class: - -* [`ensure`](#-r10k--webhook--ensure) -* [`user`](#-r10k--webhook--user) -* [`group`](#-r10k--webhook--group) -* [`background`](#-r10k--webhook--background) -* [`bin_template`](#-r10k--webhook--bin_template) -* [`service_template`](#-r10k--webhook--service_template) -* [`service_file`](#-r10k--webhook--service_file) -* [`service_file_mode`](#-r10k--webhook--service_file_mode) -* [`use_mcollective`](#-r10k--webhook--use_mcollective) -* [`is_pe_server`](#-r10k--webhook--is_pe_server) -* [`root_user`](#-r10k--webhook--root_user) -* [`root_group`](#-r10k--webhook--root_group) -* [`manage_packages`](#-r10k--webhook--manage_packages) -* [`ruby_bin`](#-r10k--webhook--ruby_bin) - -##### `ensure` - -Data type: `Any` - - - -Default value: `true` - -##### `user` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_user` - -##### `group` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_group` - -##### `background` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_background` - -##### `bin_template` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_bin_template` - -##### `service_template` - -Data type: `Any` - - - -Default value: `'webhook.service.epp'` - -##### `service_file` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_service_file` - -##### `service_file_mode` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_service_file_mode` - -##### `use_mcollective` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_use_mcollective` - -##### `is_pe_server` - -Data type: `Any` - - - -Default value: `$r10k::params::is_pe_server` - -##### `root_user` - -Data type: `Any` - - - -Default value: `$r10k::params::root_user` - -##### `root_group` - -Data type: `Any` - - - -Default value: `$r10k::params::root_group` - -##### `manage_packages` - -Data type: `Any` - - - -Default value: `true` - -##### `ruby_bin` - -Data type: `Any` - - - -Default value: `undef` - -### `r10k::webhook::config` - -== Class: r10k::webhook::config - -Set up the root r10k config file (/etc/webhook.yaml). - -=== Authors - -Zack Smith - -#### Parameters - -The following parameters are available in the `r10k::webhook::config` class: - -* [`ensure`](#-r10k--webhook--config--ensure) -* [`hash`](#-r10k--webhook--config--hash) -* [`certname`](#-r10k--webhook--config--certname) -* [`certpath`](#-r10k--webhook--config--certpath) -* [`user`](#-r10k--webhook--config--user) -* [`pass`](#-r10k--webhook--config--pass) -* [`bind_address`](#-r10k--webhook--config--bind_address) -* [`port`](#-r10k--webhook--config--port) -* [`access_logfile`](#-r10k--webhook--config--access_logfile) -* [`client_cfg`](#-r10k--webhook--config--client_cfg) -* [`default_branch`](#-r10k--webhook--config--default_branch) -* [`use_mco_ruby`](#-r10k--webhook--config--use_mco_ruby) -* [`protected`](#-r10k--webhook--config--protected) -* [`github_secret`](#-r10k--webhook--config--github_secret) -* [`gitlab_token`](#-r10k--webhook--config--gitlab_token) -* [`bitbucket_secret`](#-r10k--webhook--config--bitbucket_secret) -* [`discovery_timeout`](#-r10k--webhook--config--discovery_timeout) -* [`client_timeout`](#-r10k--webhook--config--client_timeout) -* [`prefix`](#-r10k--webhook--config--prefix) -* [`prefix_command`](#-r10k--webhook--config--prefix_command) -* [`server_software`](#-r10k--webhook--config--server_software) -* [`enable_ssl`](#-r10k--webhook--config--enable_ssl) -* [`use_mcollective`](#-r10k--webhook--config--use_mcollective) -* [`r10k_deploy_arguments`](#-r10k--webhook--config--r10k_deploy_arguments) -* [`public_key_path`](#-r10k--webhook--config--public_key_path) -* [`private_key_path`](#-r10k--webhook--config--private_key_path) -* [`yaml_template`](#-r10k--webhook--config--yaml_template) -* [`command_prefix`](#-r10k--webhook--config--command_prefix) -* [`repository_events`](#-r10k--webhook--config--repository_events) -* [`allow_uppercase`](#-r10k--webhook--config--allow_uppercase) -* [`slack_webhook`](#-r10k--webhook--config--slack_webhook) -* [`slack_channel`](#-r10k--webhook--config--slack_channel) -* [`slack_username`](#-r10k--webhook--config--slack_username) -* [`slack_proxy_url`](#-r10k--webhook--config--slack_proxy_url) -* [`slack_icon`](#-r10k--webhook--config--slack_icon) -* [`rocketchat_webhook`](#-r10k--webhook--config--rocketchat_webhook) -* [`rocketchat_channel`](#-r10k--webhook--config--rocketchat_channel) -* [`rocketchat_username`](#-r10k--webhook--config--rocketchat_username) -* [`configfile_owner`](#-r10k--webhook--config--configfile_owner) -* [`configfile_group`](#-r10k--webhook--config--configfile_group) -* [`configfile_mode`](#-r10k--webhook--config--configfile_mode) -* [`configfile`](#-r10k--webhook--config--configfile) -* [`manage_symlink`](#-r10k--webhook--config--manage_symlink) -* [`configfile_symlink`](#-r10k--webhook--config--configfile_symlink) -* [`enable_mutex_lock`](#-r10k--webhook--config--enable_mutex_lock) -* [`ignore_environments`](#-r10k--webhook--config--ignore_environments) -* [`mco_arguments`](#-r10k--webhook--config--mco_arguments) -* [`generate_types`](#-r10k--webhook--config--generate_types) - -##### `ensure` - -Data type: `Any` - - - -Default value: `true` - -##### `hash` - -Data type: `Variant[String, Hash]` - - - -Default value: `'UNSET'` - -##### `certname` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_certname` - -##### `certpath` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_certpath` - -##### `user` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_user` - -##### `pass` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_pass` - -##### `bind_address` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_bind_address` - -##### `port` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_port` - -##### `access_logfile` - -Data type: `Variant[Stdlib::Absolutepath, Enum['stderr']]` - - - -Default value: `'/var/log/webhook/access.log'` - -##### `client_cfg` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_client_cfg` - -##### `default_branch` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_default_branch` - -##### `use_mco_ruby` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_use_mco_ruby` - -##### `protected` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_protected` - -##### `github_secret` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_github_secret` - -##### `gitlab_token` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_gitlab_token` - -##### `bitbucket_secret` - -Data type: `Optional[String[1]]` - - - -Default value: `$r10k::params::webhook_bitbucket_secret` - -##### `discovery_timeout` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_discovery_timeout` - -##### `client_timeout` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_client_timeout` - -##### `prefix` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_prefix` - -##### `prefix_command` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_prefix_command` - -##### `server_software` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_server_software` - -##### `enable_ssl` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_enable_ssl` - -##### `use_mcollective` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_use_mcollective` - -##### `r10k_deploy_arguments` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_r10k_deploy_arguments` - -##### `public_key_path` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_public_key_path` - -##### `private_key_path` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_private_key_path` - -##### `yaml_template` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_yaml_template` - -##### `command_prefix` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_r10k_command_prefix` - -##### `repository_events` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_repository_events` - -##### `allow_uppercase` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_allow_uppercase` - -##### `slack_webhook` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_slack_webhook` - -##### `slack_channel` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_slack_channel` - -##### `slack_username` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_slack_username` - -##### `slack_proxy_url` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_slack_proxy_url` - -##### `slack_icon` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_slack_icon` - -##### `rocketchat_webhook` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_rocketchat_webhook` - -##### `rocketchat_channel` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_rocketchat_channel` - -##### `rocketchat_username` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_rocketchat_username` - -##### `configfile_owner` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_configfile_owner` - -##### `configfile_group` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_configfile_group` - -##### `configfile_mode` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_configfile_mode` - -##### `configfile` - -Data type: `Any` - - - -Default value: `'/etc/webhook.yaml'` - -##### `manage_symlink` - -Data type: `Any` - - - -Default value: `false` - -##### `configfile_symlink` - -Data type: `Any` - - - -Default value: `'/etc/webhook.yaml'` - -##### `enable_mutex_lock` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_enable_mutex_lock` - -##### `ignore_environments` - -Data type: `Array` - - - -Default value: `$r10k::params::webhook_ignore_environments` - -##### `mco_arguments` - -Data type: `Optional[String]` - - - -Default value: `$r10k::params::webhook_mco_arguments` - -##### `generate_types` - -Data type: `Boolean` - - - -Default value: `$r10k::params::webhook_generate_types` - -### `r10k::webhook::package` - -Private class, do not include it directly. -Installs the webhook packages - -#### Parameters - -The following parameters are available in the `r10k::webhook::package` class: - -* [`is_pe_server`](#-r10k--webhook--package--is_pe_server) -* [`provider`](#-r10k--webhook--package--provider) -* [`sinatra_version`](#-r10k--webhook--package--sinatra_version) -* [`webrick_version`](#-r10k--webhook--package--webrick_version) - -##### `is_pe_server` - -Data type: `Any` - - - -Default value: `$r10k::params::is_pe_server` - -##### `provider` - -Data type: `Any` - - - -Default value: `$r10k::params::provider` - -##### `sinatra_version` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_sinatra_version` - -##### `webrick_version` - -Data type: `Any` - - - -Default value: `$r10k::params::webhook_webrick_version` - ## Tasks ### `deploy` diff --git a/manifests/webhook.pp b/manifests/webhook.pp deleted file mode 100644 index 5856dfba..00000000 --- a/manifests/webhook.pp +++ /dev/null @@ -1,107 +0,0 @@ -# This class creates a github webhoook to allow curl style post-rec scripts -class r10k::webhook ( - $ensure = true, - $user = $r10k::params::webhook_user, - $group = $r10k::params::webhook_group, - $background = $r10k::params::webhook_background, - $bin_template = $r10k::params::webhook_bin_template, - $service_template = 'webhook.service.epp', - $service_file = $r10k::params::webhook_service_file, - $service_file_mode = $r10k::params::webhook_service_file_mode, - $use_mcollective = $r10k::params::webhook_use_mcollective, - $is_pe_server = $r10k::params::is_pe_server, - $root_user = $r10k::params::root_user, - $root_group = $r10k::params::root_group, - $manage_packages = true, - $ruby_bin = undef, -) inherits r10k::params { - File { - ensure => $ensure, - owner => $root_user, - group => $root_group, - mode => '0644', - } - - # Rewrite the params to style guide in lieu of - # using the boolean directly...for clarity? - $ensure_directory = $ensure ? { - true => 'directory', - false => 'absent', - } - - $ensure_file = $ensure ? { - true => 'file', - false => 'absent', - } - - $ensure_service = $ensure ? { - true => 'running', - false => 'stopped', - } - - $server_type = $background ? { - true => 'WEBrick::Daemon', - false => 'WEBrick::SimpleServer', - } - - file { '/var/log/webhook/access.log': - ensure => $ensure_file, - owner => $user, - group => $group, - before => Service['webhook.service'], - } - - file { '/var/log/webhook': - ensure => $ensure_directory, - owner => $user, - group => $group, - force => $ensure, - before => Service['webhook.service'], - } - - file { '/var/run/webhook': - ensure => $ensure_directory, - owner => $user, - group => $group, - before => Service['webhook.service'], - } - - file { 'webhook_bin': - ensure => $ensure_file, - content => template($bin_template), - path => '/usr/local/bin/webhook', - mode => '0755', - notify => Service['webhook.service'], - } - - systemd::unit_file { 'webhook.service': - ensure => $ensure_file, - content => epp("${module_name}/${service_template}", { 'user' => $user }), - enable => $ensure, - active => $ensure, - } - - # We don't remove the packages/ gem as - # They might be shared dependencies - if $manage_packages { - include r10k::webhook::package - } - - # Only managed this file if you are using mcollective mode - # We don't remove it as its part of PE and this is legacy - if $use_mcollective { - if $is_pe_server and versioncmp("${facts['puppetversion']}", '3.7.0') >= 0 { #lint:ignore:only_variable_string - # 3.7 does not place the certificate in peadmin's ~ - # This places it there as if it was an upgrade - file { 'peadmin-cert.pem': - ensure => 'file', - path => '/var/lib/peadmin/.mcollective.d/peadmin-cert.pem', - owner => 'peadmin', - group => 'peadmin', - mode => '0644', - content => file("${r10k::params::puppetconf_path}/ssl/certs/pe-internal-peadmin-mcollective-client.pem",'/dev/null'), - notify => Service['webhook.service'], - } - } - } -} diff --git a/manifests/webhook/config.pp b/manifests/webhook/config.pp deleted file mode 100644 index be216864..00000000 --- a/manifests/webhook/config.pp +++ /dev/null @@ -1,130 +0,0 @@ -# == Class: r10k::webhook::config -# -# Set up the root r10k config file (/etc/webhook.yaml). -# -# === Authors -# -# Zack Smith -class r10k::webhook::config ( - $ensure = true, - Variant[String, Hash] $hash = 'UNSET', - $certname = $r10k::params::webhook_certname, - $certpath = $r10k::params::webhook_certpath, - $user = $r10k::params::webhook_user, - $pass = $r10k::params::webhook_pass, - $bind_address = $r10k::params::webhook_bind_address, - $port = $r10k::params::webhook_port, - Variant[Stdlib::Absolutepath, Enum['stderr']] $access_logfile = '/var/log/webhook/access.log', - $client_cfg = $r10k::params::webhook_client_cfg, - $default_branch = $r10k::params::webhook_default_branch, - $use_mco_ruby = $r10k::params::webhook_use_mco_ruby, - $protected = $r10k::params::webhook_protected, - $github_secret = $r10k::params::webhook_github_secret, - $gitlab_token = $r10k::params::webhook_gitlab_token, - Optional[String[1]] $bitbucket_secret = $r10k::params::webhook_bitbucket_secret, - $discovery_timeout = $r10k::params::webhook_discovery_timeout, - $client_timeout = $r10k::params::webhook_client_timeout, - $prefix = $r10k::params::webhook_prefix, - $prefix_command = $r10k::params::webhook_prefix_command, - $server_software = $r10k::params::webhook_server_software, - $enable_ssl = $r10k::params::webhook_enable_ssl, - $use_mcollective = $r10k::params::webhook_use_mcollective, - $r10k_deploy_arguments = $r10k::params::webhook_r10k_deploy_arguments, - $public_key_path = $r10k::params::webhook_public_key_path, - $private_key_path = $r10k::params::webhook_private_key_path, - $yaml_template = $r10k::params::webhook_yaml_template, - $command_prefix = $r10k::params::webhook_r10k_command_prefix, - $repository_events = $r10k::params::webhook_repository_events, - $allow_uppercase = $r10k::params::webhook_allow_uppercase, - $slack_webhook = $r10k::params::webhook_slack_webhook, - $slack_channel = $r10k::params::webhook_slack_channel, - $slack_username = $r10k::params::webhook_slack_username, - $slack_proxy_url = $r10k::params::webhook_slack_proxy_url, - $slack_icon = $r10k::params::webhook_slack_icon, - $rocketchat_webhook = $r10k::params::webhook_rocketchat_webhook, - $rocketchat_channel = $r10k::params::webhook_rocketchat_channel, - $rocketchat_username = $r10k::params::webhook_rocketchat_username, - $configfile_owner = $r10k::params::webhook_configfile_owner, - $configfile_group = $r10k::params::webhook_configfile_group, - $configfile_mode = $r10k::params::webhook_configfile_mode, - $configfile = '/etc/webhook.yaml', - $manage_symlink = false, - $configfile_symlink = '/etc/webhook.yaml', - $enable_mutex_lock = $r10k::params::webhook_enable_mutex_lock, - Array $ignore_environments = $r10k::params::webhook_ignore_environments, - Optional[String] $mco_arguments = $r10k::params::webhook_mco_arguments, - Boolean $generate_types = $r10k::params::webhook_generate_types, -) inherits r10k::params { - if $hash == 'UNSET' { - $webhook_hash = { - 'user' => $user, - 'pass' => $pass, - 'bind_address' => $bind_address, - 'port' => $port, - 'certname' => $certname, - 'client_timeout' => $client_timeout, - 'discovery_timeout' => $discovery_timeout, - 'certpath' => $certpath, - 'client_cfg' => $client_cfg, - 'default_branch' => $default_branch, - 'use_mco_ruby' => $use_mco_ruby, - 'access_logfile' => $access_logfile, - 'protected' => $protected, - 'github_secret' => $github_secret, - 'gitlab_token' => $gitlab_token, - 'bitbucket_secret' => $bitbucket_secret, - 'prefix' => $prefix, - 'prefix_command' => $prefix_command, - 'server_software' => $server_software, - 'enable_ssl' => $enable_ssl, - 'use_mcollective' => $use_mcollective, - 'r10k_deploy_arguments' => $r10k_deploy_arguments, - 'public_key_path' => $public_key_path, - 'private_key_path' => $private_key_path, - 'command_prefix' => $command_prefix, - 'repository_events' => $repository_events, - 'enable_mutex_lock' => $enable_mutex_lock, - 'allow_uppercase' => $allow_uppercase, - 'slack_webhook' => $slack_webhook, - 'slack_channel' => $slack_channel, - 'slack_username' => $slack_username, - 'slack_proxy_url' => $slack_proxy_url, - 'slack_icon' => $slack_icon, - 'rocketchat_webhook' => $rocketchat_webhook, - 'rocketchat_channel' => $rocketchat_channel, - 'rocketchat_username' => $rocketchat_username, - 'ignore_environments' => $ignore_environments, - 'mco_arguments' => $mco_arguments, - 'generate_types' => $generate_types, - } - } else { - $webhook_hash = $hash - } - - $ensure_file = $ensure ? { - true => 'file', - false => 'absent', - } - $ensure_link = $ensure ? { - true => 'link', - false => 'absent', - } - - file { 'webhook.yaml': - ensure => $ensure_file, - owner => $configfile_owner, - group => $configfile_group, - mode => $configfile_mode, - path => $configfile, - content => template($yaml_template), - notify => Service['webhook.service'], - } - - if $manage_symlink { - file { 'symlink_webhook.yaml': - ensure => $ensure_link, - path => $configfile_symlink, - target => $configfile, - } - } -} diff --git a/manifests/webhook/package.pp b/manifests/webhook/package.pp deleted file mode 100644 index aacb135a..00000000 --- a/manifests/webhook/package.pp +++ /dev/null @@ -1,34 +0,0 @@ -# Private class, do not include it directly. -# Installs the webhook packages -class r10k::webhook::package ( - $is_pe_server = $r10k::params::is_pe_server, - $provider = $r10k::params::provider, - $sinatra_version = $r10k::params::webhook_sinatra_version, - $webrick_version = $r10k::params::webhook_webrick_version, -) inherits r10k::params { - if !defined(Package['sinatra']) { - package { 'sinatra': - ensure => $sinatra_version, - provider => $provider, - notify => Service['webhook.service'], - } - } - - if (! $is_pe_server) { - if !defined(Package['webrick']) { - package { 'webrick': - ensure => $webrick_version, - provider => $provider, - notify => Service['webhook.service'], - } - } - - if !defined(Package['json']) { - package { 'json': - ensure => installed, - provider => $provider, - notify => Service['webhook.service'], - } - } - } -}