Puppet Class: subscription_manager::config

Defined in:
manifests/config.pp

Overview

Class subscription_manager::config

This class is called from subscription_manager for service config.

Authors


  • GaĆ«l Chamoulaud <gchamoul@redhat.com>

  • JD Powell <waveclaw@waveclaw.net>

Copyright


Copyright 2016 JD Powell <waveclaw@waveclaw.net>



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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'manifests/config.pp', line 17

class subscription_manager::config {

  # prefer activation keys to username.  Then fail when neither are provided
  if  $::subscription_manager::activationkey != undef and
      $::subscription_manager::activationkey != '' {
        $_settings = {
          'pool'          => $::subscription_manager::pool,
          'autosubscribe' => $::subscription_manager::autosubscribe,
          'force'         => $::subscription_manager::force,
          'org'           => $::subscription_manager::org,
          'servicelevel'  => $::subscription_manager::servicelevel,
          'activationkey' => $::subscription_manager::activationkey,
          'release'       => $::subscription_manager::release,
        }
  } else {
    if  $::subscription_manager::username != undef and
        $::subscription_manager::username !='' and
        $::subscription_manager::password != undef and
        $::subscription_manager::password != '' {
          $_settings = {
            'pool'          => $::subscription_manager::pool,
            'autosubscribe' => $::subscription_manager::autosubscribe,
            'force'         => $::subscription_manager::force,
            'org'           => $::subscription_manager::org,
            'servicelevel'  => $::subscription_manager::servicelevel,
            'username'      => $::subscription_manager::username,
            'password'      => $::subscription_manager::password,
            'lifecycleenv'  => $::subscription_manager::lifecycleenv,
            'release'       => $::subscription_manager::release,
          }
    } else {
      $_settings = {}
    }
  }

  # this part can be used with a pulp server used to 'init' new servers
  #  if $::subscription_manager::config_hash['rhsm_baseurl'] == undef {
  #    $_conf_params['/etc/rhsm/rhsm.conf']['rhsm_baseurl'] =
  #      "https://${::subscription_manager::server_hostname}/pulp/repos"
  #  }
    rhsm_config { '/etc/rhsm/rhsm.conf':
      ensure => present,
      *      => $::subscription_manager::config_hash,
    }

  # Four cases
  # I.  never registered
  # II. registered to correct server but forcing it
  # III. registered to different server
  # IV. registered to same server but forcing it
  if ($::facts['rhsm_identity'] == '' or $::facts['rhsm_identity'] == undef or
      $::facts['rhsm_ca_name'] != $::subscription_manager::server_hostname or
      $::subscription_manager::force == true ) {
      rhsm_register { $::subscription_manager::server_hostname:
        ensure  => present,
        require => Rhsm_config['/etc/rhsm/rhsm.conf'],
        *       =>  $_settings,
      }
  }

}