Puppet Class: psick::gitlab::cli

Defined in:
manifests/gitlab/cli.pp

Overview

This class installs and configures via tp the gitlab-cli tool, used to compare Puppet catalogs from different sources

Parameters:

  • ensure (String) (defaults to: 'present')

    Define if to install (present), remove (absent) or the version of the gitlab-cli gem

  • auto_prereq (Boolean) (defaults to: $::psick::auto_prereq)

    Define if to automatically install the prerequisites needed by gitlab-cli

  • epp (Optional[String]) (defaults to: 'psick/gitlab/cli/gitlab-cli.conf.epp')

    The path of the epp template (as used in epp()) to use as content for the gitlab-cli configuration file. Note that this file is not an official file for gitlab-cli. It’s used by scripts executed in CI steps involving merge request and accept operations.

  • template (Optional[String]) (defaults to: undef)

    The path of the erb template (as used in template() to use as content for gitlab-cli config file. This is alternative to epp.

  • config_hash (Hash) (defaults to: {})

    An open hash of options you can use in your template. Note that this hash is merged with an hash of default options provided in the class



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
# File 'manifests/gitlab/cli.pp', line 20

class psick::gitlab::cli (
  String           $ensure      = 'present',
  Boolean          $auto_prereq = $::psick::auto_prereq,
  Optional[String] $epp         = 'psick/gitlab/cli/gitlab-cli.conf.epp',
  Optional[String] $template    = undef,
  Hash             $config_hash = {},
) {

  $default_hash = {
    project_id => '',
    private_token => '',
    api_endpoint => "https =>//gitlab.${::facts['networking']['domain']}/api/v3",
    httparty_options => '{verify: false}',
    assigned_user => '',
    milestone => '',
    labels => 'automerge',
    add_target_label => false,
    add_source_label => false,
    prefix_target_label => 'TO_',
    prefix_source_label => 'FROM_',
  }
  $options = $default_hash + $config_hash

  ::tp::install { 'gitlab-cli' :
    ensure      => $ensure,
    auto_prereq => $auto_prereq,
  }
  if $template or $epp {
    $file_content = $template ? {
      undef   => epp($epp),
      default => template($template),
    }
    file { '/etc/gitlab-cli.conf':
      ensure  => $ensure,
      content => $file_content,
    }
  }

}