Ask Your Question
0

Having trouble with subscription_manager module

asked 2016-05-03 09:57:11 -0500

Hi,

I am trying to implement the "waveclaw/subscription_manager" module, so that I can automate the registering of my redhat systems with my satellite server.

I have created a satellite.pp file with the following contents:

#
#    
#
    class profiles::os::linux::distro::redhat::satellite {
      subscription_manager: {
        server_hostname => 'satellite.mydomain.com',
        username        => 'myuser',
        password        => 'mypassword',
        autosubscribe   => true,
        org             => 'MyOrg',
        environment     => 'Library',
      }
    }

When i try running a puppet agent -t on a properly classified node, I get the following error message:

Info: Retrieving pluginfacts
Notice: /File[/opt/puppetlabs/puppet/cache/facts.d/rhsm_available_repos.yaml]/ensure: removed
Notice: /File[/opt/puppetlabs/puppet/cache/facts.d/rhsm_disabled_repos.yaml]/ensure: removed
Notice: /File[/opt/puppetlabs/puppet/cache/facts.d/rhsm_enabled_repos.yaml]/ensure: removed
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Syntax error at ':' at /etc/puppetlabs/code/environments/dev_puppet/site/profiles/manifests/os/linux/distro/redhat/satellite.pp:5:23 on node puppetclient.mydomain.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
#

So its telling me there's a syntax error at the ':', but that doesn't look right to me, since the colon should go there. Please advise - I can't seem to recover from this error, since it doesn't seem to make sense to me.

  • Thanks,

Todd

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-05-04 12:40:41 -0500

Marek Maksimczyk gravatar image

updated 2016-05-04 12:45:51 -0500

According documentation from https://forge.puppet.com/waveclaw/subscriptionmanager subscriptionmanager is class so you should use

class { 'subscription_manager':
   server_hostname => 'satellite.mydomain.com',
    username        => 'myuser',
    password        => 'mypassword',
    autosubscribe   => true,
    org             => 'MyOrg',
    environment     => 'Library',
}

If it was resource/defined type, you should use this kind of call:

 subscription_manager { "subscription_manager_name":
    server_hostname => 'satellite.mydomain.com',
    username        => 'myuser',
    password        => 'mypassword',
    autosubscribe   => true,
    org             => 'MyOrg',
    environment     => 'Library',
  }

Please check:

edit flag offensive delete link more
0

answered 2016-05-05 16:03:35 -0500

Thank you,

I guess I see that the documentation tells me how to call it. However, I don't use any of my other classes in any of my other .pp files in this way.

I have a site/profiles/manifests/os/linux.pp file that has a line like this:

include ::subscription_manager

And I have a site/profiles/manifests/os/linux/distro.pp file that looks like this:

# Determine which distro we're using.
class profiles::os::linux::distro {
  if ($::facts['osfamily'] == 'Suse'){
    include ::profiles::os::linux::distro::suse
  }
  elsif ($::facts['osfamily'] == 'RedHat'){
    ####
    # Maybe we should make sure the machine is registered with satelite
    # before proceeding.
    include ::profiles::os::linux::distro::redhat::satellite
    include ::profiles::os::linux::distro::redhat

    Class['::profiles::os::linux::distro::redhat::satellite']->Class['::profiles::os::linux::distro::redhat']
  }
  else {
    include ::profiles::os::linux::distro::other
  }
}

From there, I have my site/profiles/manifests/os/linux/distro/redhat/satellite.pp file which looks like above:

class profiles::os::linux::distro::redhat::satellite {
  subscription_manager: {
    server_hostname => 'satellite.mydomain.com',
    username        => 'myuser',
    password        => 'mypassword',
    autosubscribe   => true,
    org             => 'MyOrg',
    environment     => 'Library',
  }
}

I understand that the documentation tells me to use it in this way:

class { 'subscription_manager':
   server_hostname => 'satellite.mydomain.com',
    username        => 'myuser',
    password        => 'mypassword',
    autosubscribe   => true,
    org             => 'MyOrg',
    environment     => 'Library',
}

But I don't know how to syntactically do this for my setup. I am confused, as most of the classes that I've worked with have allowed me to use them in the way I've tried. I don't know how to do that with this class. Obviously, if i put the code above into my satellite.pp, puppet will complain that it can't find class ::profiles::os::linux::distro::redhat::satellite. This makes sense, since I am not using a class called that in my satellite.pp file.

Please advise.

  • Thanks,

Todd

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-05-03 09:57:11 -0500

Seen: 64 times

Last updated: May 05 '16