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: 'E8A032E094D8EB4EA189D270DA418C88A3219F7B')

    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)


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
# File 'manifests/repo.pp', line 21

class hashi_stack::repo (
  Optional[Integer] $priority = undef,
  String $proxy = 'absent',
  String $key_id = 'E8A032E094D8EB4EA189D270DA418C88A3219F7B',
  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,
) {
  case $facts['os']['family'] {
    'Debian': {
      include apt

      apt::source { 'HashiCorp':
        ensure       => 'present',
        architecture => 'amd64',
        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       => 1,
        proxy         => $proxy,
        priority      => $priority,
      }
    }
    default: {
      fail("\"${module_name}\" provides no repository information for OSfamily \"${facts['os']['family']}\"")
    }
  }
}