# rhn module

**URL:** <https://forum.ansible.com/t/rhn-module/12516>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [March 17, 2013, 3:11pm UTC](https://forum.ansible.com/t/rhn-module/12516 "2013-03-17T15:11:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vincent\_Van\_der\_Kuss](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@Vincent\_Van\_der\_Kuss](https://forum.ansible.com/u/Vincent_Van_der_Kuss)\
**Post date:** [March 17, 2013, 3:11pm UTC](https://forum.ansible.com/t/rhn-module/12516/1 "2013-03-17T15:11:19Z")

</div>

Hi,

We are currently getting started with Ansible, and we really like it!

Since we use RHEL for a large part of our infra I did an attempt to  
create an Ansible module that allows you to  
add or remove software channels from a machine. I tried to keep the  
dependencies to other Python mods to a  
minimum and currently only use things from Python core.  
I do however have some doubts and it would be nice if someone would  
share his thoughts 🙂

To test the module I used a hostname variable. It is of course not  
meant to stay that way because that would  
make the module rather useless...  
My plan was to use the hostname var because we register our machines  
in rhn with their hostname, but other  
people might give it names other than the hostname. Any suggestions on this?

Currently I fetch the machine's id from rhn while I could get it from  
/etc/sysconfig/rhn/systemid (I already made a function  
for that in the module). The reason for this is that I've seen  
machines where the local systemid differs from the systemid in rhn.  
I would like to go for the local systemid since it makes things  
easier... Suggestions?

Let me also tell you that I'm a newbie in Python, but I must say that  
I really enjoy it and plan on extending this module.  
It would maybe be nice to add rhn info about the machine to the machine's facts?

Module on Github :  
[https://github.com/vincentvdk/ansible\_modules/tree/master/rhn](https://github.com/vincentvdk/ansible_modules/tree/master/rhn)

Thanks!  
Vincent

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 17, 2013, 4:32pm UTC](https://forum.ansible.com/t/rhn-module/12516/2 "2013-03-17T16:32:31Z")

</div>

I would tenatively call this "rhn\_channel" but this looks super clean to me.

I would like to see the server name be an optional parameter so you  
could use it with Satellite server.

Minor style note would be to use\_underscores versus camelCase in functions.

If you want to fix those things up, I'd love to have a pull request for this!

Thanks!

--Michael

---

<div class="post-metadata">

**Author:** ![Vincent\_Van\_der\_Kuss](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@Vincent\_Van\_der\_Kuss](https://forum.ansible.com/u/Vincent_Van_der_Kuss)\
**Post date:** [March 17, 2013, 9:16pm UTC](https://forum.ansible.com/t/rhn-module/12516/3 "2013-03-17T21:16:46Z")

</div>

> I would tenatively call this "rhn\_channel" but this looks super clean to me.

rhn\_channel does indeed make more sense. I'll change that. Thanks.

> I would like to see the server name be an optional parameter so you  
> could use it with Satellite server.

Ok. fair enough

> Minor style note would be to use\_underscores versus camelCase in functions.
> 
> If you want to fix those things up, I'd love to have a pull request for this!

I'll make the changes and send a pull request in the next few days.  
Thanks!

> Thanks!
> 
> --Michael

Vincent
