Puppet Class: snap

Defined in:
manifests/init.pp

Overview

Parameters:

  • package_ensure (String[1]) (defaults to: 'installed')

    The state of the snapd package.

  • service_ensure (Enum['stopped', 'running']) (defaults to: 'running')

    The state of the snapd service.

  • service_enable (Boolean) (defaults to: true)

    Run the system service on boot.

  • core_snap_ensure (String[1]) (defaults to: 'installed')

    The state of the snap ‘core`.

  • manage_repo (Boolean) (defaults to: false)

    Whether we should manage EPEL repo or not.

  • net_http_unix_ensure (Enum['present', 'installed', 'absent']) (defaults to: 'installed')

    The state of net_http_unix gem.



9
10
11
12
13
14
15
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
# File 'manifests/init.pp', line 9

class snap (
  String[1]                              $package_ensure       = 'installed',
  Enum['stopped', 'running']             $service_ensure       = 'running',
  Boolean                                $service_enable       = true,
  String[1]                              $core_snap_ensure     = 'installed',
  Boolean                                $manage_repo          = false,
  Enum['present', 'installed', 'absent'] $net_http_unix_ensure = 'installed',
) {
  if $manage_repo {
    include epel
    Yumrepo['epel'] -> Package['snapd']
  }

  package { 'snapd':
    ensure => $package_ensure,
  }

  if $facts['os']['family'] == 'RedHat' {
    file { '/snap':
      ensure  => link,
      target  => '/var/lib/snapd/snap',
      require => Package['snapd'],
    }
  }

  service { 'snapd':
    ensure  => $service_ensure,
    enable  => $service_enable,
    require => Package['snapd'],
  }

  -> package { 'net_http_unix':
    ensure   => $net_http_unix_ensure,
    provider => 'puppet_gem',
  }

  if $service_ensure == 'running' {
    package { 'core':
      ensure   => $core_snap_ensure,
      provider => 'snap',
      require  => [Package['net_http_unix'], Service['snapd']],
    }
  }
}