Puppet Class: rke

Defined in:
manifests/init.pp

Summary

Install RKE binary

Overview

Parameters:

  • version (String) (defaults to: '1.3.4')

    RKE release version

  • checksum (String) (defaults to: '92440ec62468d329ca26829b2a1d5624aa7a5d37054596633e4e838549a22946')

    Artifact checksum string

  • checksum_type (String) (defaults to: 'sha256')

    The digest algorithm used for the checksum string.

  • base_path (Stdlib::Absolutepath) (defaults to: '/opt/rke')

    Base path under which to install software.



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

class rke (
  String $version                 = '1.3.4',
  String $checksum                = '92440ec62468d329ca26829b2a1d5624aa7a5d37054596633e4e838549a22946',
  String $checksum_type           = 'sha256',
  Stdlib::Absolutepath $base_path = '/opt/rke',
) {
  $bin_path     = '/usr/bin'
  $dl_path      = "${base_path}/dl"
  $version_path = "${dl_path}/${version}"

  $uname        = 'linux'
  $arch         = 'amd64'
  $base_url     = "https://github.com/rancher/rke/releases/download/v${version}"
  $archive_file = "rke_${uname}-${arch}"
  $source       = "${base_url}/${archive_file}"
  $dest_path    = "${version_path}/${archive_file}"

  file { [$base_path, $dl_path, $version_path]:
    ensure => directory,
    owner  => 'root',
    group  => 'root',
    mode   => '0755',
  }

  archive { $archive_file:
    ensure        => present,
    checksum      => $checksum,
    checksum_type => $checksum_type,
    cleanup       => false,
    extract       => false,
    path          => $dest_path,
    source        => $source,
    require       => File[$version_path],
  }
  -> file { $dest_path:
    ensure => file,
    owner  => 'root',
    group  => 'root',
    mode   => '0755',
  }

  file { "${bin_path}/rke":
    ensure  => link,
    target  => "${version_path}/${archive_file}",
    require => Archive[$archive_file],
  }
}