Puppet Class: hashi_stack::repo

Defined in:
manifests/repo.pp

Summary

Set up the package repository for the HashiCorp Stack components

Overview

This class installs the hashicorp repository

Examples:

Inclusion using defaults

include hashi_stack::repo

Include repo and install packer as package

include hashi_stack::repo
package { 'packer':
  ensure  => installed,
  require => Class['Hashi_stack::Repo'],
}

Parameters:

  • priority (Optional[Integer]) (defaults to: undef)

    A numeric priority for the repo, passed to the package management system

  • proxy (String) (defaults to: 'absent')

    The URL of a HTTP proxy to use for package downloads (YUM only)

  • key_id (String) (defaults to: '798AEC654E5C15428C8E42EEAA16FCBCA621E701')

    GPG key to authenticate Apt package signatures.

  • key_source (Stdlib::HTTPSUrl) (defaults to: 'https://apt.releases.hashicorp.com/gpg')

    The location of an existing GPG key file to copy.

  • description (String) (defaults to: 'HashiCorp package repository.')

    Repository description

  • rpm_base (String) (defaults to: 'https://rpm.releases.hashicorp.com')

    Base URL for the Yum repository

  • repo_gpgcheck (Integer[0,1]) (defaults to: 0)

    enables gpg validation of packages from the repo

  • repo_enabled (Integer[0,1]) (defaults to: 1)

    enables/disables the repository



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
72
73
74
75
76
# File 'manifests/repo.pp', line 24

class hashi_stack::repo (
  Optional[Integer] $priority = undef,
  String $proxy = 'absent',
  String $key_id = '798AEC654E5C15428C8E42EEAA16FCBCA621E701',
  Stdlib::HTTPSUrl $key_source = 'https://apt.releases.hashicorp.com/gpg',
  String $description = 'HashiCorp package repository.',
  String $rpm_base = 'https://rpm.releases.hashicorp.com',
  Integer[0,1] $repo_gpgcheck = 0,
  Integer[0,1] $repo_enabled = 1,
) {
  $arch = $facts['os']['architecture'] ? {
    'aarch64' => 'arm64',  # 'aarch64' is official, but Hashicorp uses 'arm64'
    default   => $facts['os']['architecture'],
  }

  case $facts['os']['family'] {
    'Debian': {
      include apt

      apt::source { 'HashiCorp':
        ensure       => 'present',
        architecture => $arch,
        comment      => $description,
        location     => 'https://apt.releases.hashicorp.com',
        repos        => 'main',
        key          => {
          'id'     => $key_id,
          'source' => $key_source,
        },
        include      => {
          'deb' => true,
          'src' => false,
        },
        pin          => $priority,
      }
    }
    'RedHat': {
      yumrepo { 'HashiCorp':
        descr         => $description,
        baseurl       => "${rpm_base}/RHEL/\$releasever/\$basearch/stable",
        gpgcheck      => 1,
        gpgkey        => $key_source,
        repo_gpgcheck => $repo_gpgcheck,
        enabled       => $repo_enabled,
        proxy         => $proxy,
        priority      => $priority,
      }
    }
    default: {
      fail("\"${module_name}\" provides no repository information for OSfamily \"${facts['os']['family']}\"")
    }
  }
}