Hi all,

as the maintainer of the Ansible Foreman modules 
<https://github.com/Nosmoht/ansible-module-foreman> i would like to share 
my thoughts with you.

First of all i really like the idea to bring Foreman modules into Ansible. 
The complete configuration of Foreman is much easier if you can use 
Infrastructure as Code.
That was the reason why i started the implementation in March 2015. At this 
time Ansible didn't have the module_utils folder and modules had to be 
"self contained". 
So the only way to use shared code was to create a Python library and use 
it. My result of that constraint is the Python Foreman library 
<https://github.com/Nosmoht/python-foreman>.
It was and still is a challenge to always sync the modules and the library 
functionality.

As far as i can see Nailgun is the library to work with Satellite 6 API.

In regards to the future used library i see three different options so far:
1. nailgun
2. python-foreman
3. Ansible's module_utils.

I don't want to talk about functionality here, but more about constraints 
and dependencies. 
If either nailgun or python-foreman is used people would have to install 
the library to use the Ansible modules and could have the same sync issue 
like i had in the past.
Besides that i believe the library would have even more dependencies 
(python-requests for example) which could make things even more worst.
On the other hand people would have a Python library that could even be 
used outside of Ansible for other tasks.

If all that stuff is put into Ansible's module_utils folder we wouldn't 
have any sync issue nor external dependencies, but the usage would be 
limited to Ansible.
And Ansible provides a great framework that abstracts a lot of things 
(methods like fetch_url() and open_url()) that otherwise would have to be 
reimplemented.

Long term speaking i believe a common Python library would be the winner as 
it provides a standardized and well tested Foreman/Satellite interface to 
the world.

I'm not sure how far the nailgun development is, but python-foreman is open 
source and i'm happy to hand out the ownership of that repository.



Next topic: Ansible modules

I've already done a lot of work to move the modules from python-foreman + 
modules into "everything in Ansible". 
Means all the library stuff goes into module_utils/foreman.py plus all the 
modules in modules/cloud/foreman/*.py.
Nearly 75% of that work is done so i could open a PR for each module that 
is already finished.
If that's something the community would like to see...let's do it :-)

I wanted to commit that code into 
https://github.com/theforeman/foreman-ansible-modules but had some issue.
- I would overwrite the nailgun using modules like foreman_ptable.py etc.
- there is no place to put Ansible module documentation fragments into like 
utils/module_docs_fragments/foreman.py

If anyone has an idea how to fix that let me know ;)


Happy to see how it's going on
Nosmoht

-- 
You received this message because you are subscribed to the Google Groups 
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to