# Puppet Class: puppet_cd::r10k::install

Inherits:
  puppet_cd::params

Defined in:
  manifests/r10k/install.pp

## Summary

Class manages r10k installation for the puppet_cd module.

## Overview

puppet_cd::r10k::install.pp Module name: puppet_cd Author: Arne Teuke (arne_teuke@confdroid)

    6
    7
    8
    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
    53
    54
    55
    56
    57

    # File 'manifests/r10k/install.pp', line 6

    class puppet_cd::r10k::install (

    ) inherits puppet_cd::params {
      if ($pt_pm_fqdn == $fqdn) and ($pt_use_r10k == true) {
        # enable CRB
        exec { 'enable_crb':
          command => 'dnf config-manager --set-enabled crb',
          unless  => 'dnf repolist --disabled | grep -qE "crb|CodeReady"',
          path    => ['/usr/bin', '/bin'],
        }

        # install required packages
        package { $pt_r10k_pkg:
          ensure  => $pt_pkg_ensure,
          before  => Package['r10k'],
          require => Exec['enable_crb'],
        }

        # install r10k via gem
        package { 'r10k':
          ensure   => $pt_pkg_ensure,
          provider => gem,
        }

        # create r10k dir
        file { 'r10k_dir':
          ensure   => directory,
          path     => $pt_r10k_dir,
          owner    => 'root',
          group    => 'root',
          mode     => '0755',
          selrange => s0,
          selrole  => object_r,
          seltype  => puppet_etc_t,
          seluser  => unconfined_u,
        }

        # configure r10k.yaml
        file { $pt_r10k_file:
          ensure   => file,
          owner    => 'root',
          group    => 'root',
          mode     => '0644',
          selrange => s0,
          selrole  => object_r,
          seltype  => puppet_etc_t,
          seluser  => unconfined_u,
          require  => File['r10k_dir'],
          content  => template($pt_r10k_erb),
        }
      }
    }