# Having trouble with subscription_manager module

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',
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
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 close merge delete

Sort by » oldest newest most voted

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

class { 'subscription_manager':
server_hostname => 'satellite.mydomain.com',
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',
autosubscribe   => true,
org             => 'MyOrg',
environment     => 'Library',
}


more

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',
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',
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.

• Thanks,

Todd

more