Foreman => RHN integration

Hi,

I need to integrate foreman with RHN, so that when i create VM, it would be
autumatiacly subscribed tho RHN licence and when i delet VM in foreman
licence should be free,

For the first task, Looks like i can use redhat_register
<https://github.com/theforeman/community-templates/blob/master/snippets/redhat_register.erb>snipet
in the kikcstart, In my case i assigend a varibale "activation_key" on my
base hostgroup. So it gives following syntax on kickstart

Activation in RHN based on @host.params["activation_key"].

> # See hostgroups parameters
> <%= snippets "redhat_register" %>

For the 2-nd taks, looks like i shall use foreamn_hook with some python
call to xmlrpc in order to free the licence. But i can't find any working
example. Not in internet nor on redhat site.

any ideas?

Additional issues:
How to store RHN password, more or less securely ?
How to assign vms to particular virtualisation host (comute resource),
without generating activation_keys for each of them? We have RHEV licence
that allows to host unlimited RHELs.

> Hi,
>
> I need to integrate foreman with RHN, so that when i create VM, it would be
> autumatiacly subscribed tho RHN licence and when i delet VM in foreman
> licence should be free,
>
> For the first task, Looks like i can use redhat_register
> <https://github.com/theforeman/community-templates/blob/master/snippets/redhat_register.erb&gt;snipet
> in the kikcstart, In my case i assigend a varibale "activation_key" on my
> base hostgroup. So it gives following syntax on kickstart
>
> # Activation in RHN based on @host.params["activation_key"].
> > # See hostgroups parameters
> > <%= snippets "redhat_register" %>
>
>
>
> For the 2-nd taks, looks like i shall use foreamn_hook with some python
> call to xmlrpc in order to free the licence. But i can't find any working
> example. Not in internet nor on redhat site.
>
> any ideas?

I haven't seen a pre-written hook for it, but it's doable with some
work.

There's a python example here:
Red Hat Satellite 5: How to delete a system profile from client side or using a command on cli? - Red Hat Customer Portal

RHN Classic is deprecated, so it doesn't have the same newer API's that
Spacewalk has like searching by hostname - so I think you'll be limited
to deleting the system by systemid or searching the listUserSystems
output.

API docs for RHN are here:
Red Hat Customer Portal - Access to 24x7 support and knowledge

If you go the systemid route, you'll have to get that info
(/etc/sysconfig/rhn/systemid) into Foreman with a custom fact. In your
host destroy hook, query the foreman API for facts, get the systemid,
and delete the system from RHN.

··· On Tue, Jan 13, 2015 at 04:16:27AM -0800, Iakov Gan wrote:

Additional issues:
How to store RHN password, more or less securely ?
How to assign vms to particular virtualisation host (comute resource),
without generating activation_keys for each of them? We have RHEV licence
that allows to host unlimited RHELs.


You received this message because you are subscribed to the Google Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


Best Regards,

Stephen Benjamin
Red Hat Engineering