Puppet Class: rhsm

Defined in:
manifests/init.pp

Overview

Class: rhsm

Subscribe the node to the RHSM

Parameters

Document parameters here.

rh_user

User for the Customer Portal

rh_password

Password for the rh_user account

servername

Servername, default is provided.

proxy_hostname

Proxy hostname

proxy_port

Proxy port

proxy_user

Proxy user

proxy_password

Proxy password

baseurl

Base URL for rhsm, default provided.

manage_repos

Manage the repositories

Examples

include rhsm

Hierafile:


rhsm::rh_user: myuser rhsm::rh_password: mypassword

Authors

Ger Apeldoorn <info@gerapeldoorn.nl>

Copyright 2014 Ger Apeldoorn, unless otherwise noted.

Parameters:

  • rh_user (Any)
  • rh_password (Any)
  • servername (Any) (defaults to: 'subscription.rhn.redhat.com')
  • proxy_hostname (Any) (defaults to: undef)
  • proxy_port (Any) (defaults to: undef)
  • proxy_user (Any) (defaults to: undef)
  • proxy_password (Any) (defaults to: undef)
  • baseurl (Any) (defaults to: 'https://cdn.redhat.com')
  • manage_repos (Any) (defaults to: 1)


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

class rhsm (
 $rh_user,
 $rh_password,
 $servername = 'subscription.rhn.redhat.com',
 $proxy_hostname = undef,
 $proxy_port = undef,
 $proxy_user = undef,
 $proxy_password = undef,
 $baseurl= 'https://cdn.redhat.com',
 $manage_repos = 1,
) {

  if $proxy_hostname {
    $proxycli = "--proxy=http://${proxy_hostname}:${proxy_port} --proxyuser=${proxy_user} --proxypass=${proxy_password}"
  }

  $command = "/usr/sbin/subscription-manager register --force --name=\"${::fqdn}\"  --username=\"${rh_user}\" --password=\"${rh_password}\" --auto-attach ${proxycli} && /usr/sbin/subscription-manager repo-override --repo rhel-${::operatingsystemmajrelease}-server-optional-rpms --add=enabled:1 && /usr/sbin/subscription-manager repo-override --repo rhel-${::operatingsystemmajrelease}-server-extras-rpms --add=enabled:1"
  

  

  file { '/etc/rhsm/rhsm.conf':
    ensure => file,
  }

  exec { 'RHNSM-register':
    command => $command,
    unless  => '/usr/sbin/subscription-manager list | grep Subscribed',
  }
}