foreman-ansible-modules icon indicating copy to clipboard operation
foreman-ansible-modules copied to clipboard

Add and Remove Hosts from Host Collection

Open jamesmarshall24 opened this issue 3 years ago • 9 comments

SUMMARY

Expand a module or add a new module which allows hosts to be added/removed from host collections

ISSUE TYPE
  • Feature Idea

jamesmarshall24 avatar Mar 16 '21 21:03 jamesmarshall24

This is a valid feature request. We have host and host_collection modules, and either should be able to manage host <-> host_collection associations

wbclark avatar Mar 30 '21 14:03 wbclark

I'd love to have this functionality. I'm looking to use host collections as my data source for ansible groups. I'm aware that I could do this using host groups, but I prefer to use host collections because host groups have other configuration associated with them, such as OS version, PXE templates, etc.

lcrownover avatar Oct 14 '22 19:10 lcrownover

I would also like to have this functionality.

As a stopgap, I hacked together a module that has this functionality and put it in https://github.com/kkeane/theforeman-addon

It is not code I'm most proud of, and not suitable as a contribution to the collection, but serves the purpose for me, and hopefully for others until this functionality is added to the collection itself.

kkeane avatar Dec 23 '22 08:12 kkeane

I will try to pick this up after Tech Exchange.

parmstro avatar Jan 12 '23 15:01 parmstro

I would also like to have this functionality.

As a stopgap, I hacked together a module that has this functionality and put it in https://github.com/kkeane/theforeman-addon

It is not code I'm most proud of, and not suitable as a contribution to the collection, but serves the purpose for me, and hopefully for others until this functionality is added to the collection itself.

Any chance you will be submitting it to this collection? Since nobody else seems to be working on this.

gardar avatar Mar 07 '23 11:03 gardar

@gardar That had been my original plan, but I found that it is not trivial to fit into the collection. The collection has a specific, and very complex, way of mapping attributes between Ansible and the API, and I'm plain not experienced enough with it to make it work

If you want to take a stab at it, feel free - my code is open source, after all. As usual, just keep it open source, give me credit, yadayada. You may need to rewrite it from scratch to fit into the collection, if it can be done at all. I suspect that the issue is deeper, that the architecture of the collection itself may not fit for host collections (and a few of the other missing pieces that I also put into my own collection). That's probably why nobody else worked on it despite a clear need from the community.

kkeane avatar Mar 07 '23 12:03 kkeane

@kkeane understood, unfortunately I'm not familiar enough with the collection myself to be able to shed some light into what needs to be done, I'm assuming you've seen these docs: https://theforeman.org/plugins/foreman-ansible-modules/ But perhaps @evgeni or @parmstro can give pointers?

With that being said, could you package your module as a ansible collection? That way it would be easy to install it as a dependency.

gardar avatar Mar 07 '23 13:03 gardar

I'm trying to revive this dead issue. :-) Does anyone have time to look into it? Unfortunately I'm not experienced enough at Python to contribute.

tuxpreacher avatar Nov 08 '23 09:11 tuxpreacher

Hi,

we are using the Red Hat Satellite and looking forward to being able to add and remove hosts on host collections using theforeman.foreman.host_collection module or a new one. I think, the host module would not be the proper one, when the users are not using it to manage their hosts.

@evgeni @parthaa @mdellweg what do you think?

afeefghannam89 avatar Apr 11 '24 15:04 afeefghannam89