theforeman / foreman-ansible-modules

Ansible modules for interacting with the Foreman API and various plugin APIs such as Katello
GNU General Public License v3.0
147 stars 163 forks source link

How to proceed with the host module #256

Closed Fobhep closed 4 years ago

Fobhep commented 5 years ago

The host module is surely one of the most desired modules, which do not exist yet. Currently we have an orphaned PR for the host module, last feedback was over a year ago. @mdellweg and me had today a little brainstorming and I want to propose a possible way to make some progress with this matter.

Of course your opinion @ismaelpuerto to this is highly appreciated, since you created a first PR for that.

I am not sure yet if there are any major drawbacks with that approach. However I am happy to hear your opinion @sean797 @evgeni @akofink @mdellweg. Feel free to add other people to the discussion!

mdellweg commented 5 years ago

I want to emphasize the possibility to commit small changes in this proceeding, which hopefully speeds up the process.

evgeni commented 5 years ago

I currently have no use for a host module, so whatever you can come up with is good for me ;)

One thing to keep in mind: the Host entity has one of the most complicated validations we have, so starting with just a few attributes for create/update is still a lot of work. Maybe start with a host that has managed=false and then add from there?

akofink commented 5 years ago

I also have no use for this module that I can think of. I'm definitely fine with an iterative approach, starting with a minimal module.

ismaelpuerto commented 5 years ago

Thanks for you work @Fobhep

Fobhep commented 5 years ago

Thanks for you work @Fobhep

:) happy to get your feedback/contributions in the next iterative amendments to host and hostgroup ;)

evgeni commented 5 years ago

given we have a basic host module now, should this be considered done?

mdellweg commented 5 years ago

I think we are in the middle of step 2 here.

Fobhep commented 5 years ago

yap - I agree with @mdellweg

evgeni commented 5 years ago

oki, thanks for the input!

mdellweg commented 5 years ago

We should at least mention #429, #389 and #366 here. I think, they establish that we can move to bullet-point 3 of this issue now.

evgeni commented 5 years ago

Yepp, I agree. Wonder if most of the params we have for host and hostgroup should move to a central place as both accept a huge list of identical params?

akofink commented 5 years ago

Also consider that host and hostgroup are extensible by Foreman plugins. Which of these plugin params should it support? Maybe we could offer a flexible interface that allows users to pass any random param?

mdellweg commented 5 years ago

If i recall @evgeni s recent talk correctly, that is what we wanted to go away from with the individual modules. Also we have parameters (like open_spap_proxy) that are only working (and hopefully so documented) in combination with certain plugins.

akofink commented 5 years ago

Right, I was more saying that we could have an additional_params dictionary, like this:

foreman_host:
  name: 'foo'
  ...
  additional_params:
    foreman_salt_environment:
      id: {{ salt_environment_id }}
    foreman_openscap_policy: xccdf_org.ssgproject.content_profile_hipaa
evgeni commented 5 years ago

Why additional instead of directly in the spec? Or would additional be free form and passed to the api without processing?

evgeni commented 5 years ago

Btw, i think we currently drop the params that don't match plugins (like scap) silently, we should warn the user here

akofink commented 5 years ago

Yes, I was thinking they would just be passed raw to the API. This way we wouldn't necessarily have to support all plugins within FAM. I'm not suggesting we do it, rather just consider it as an idea. :)

gmangin commented 4 years ago

Hey ! i tried to find a way to add interfaces_attributes but i didn't succeed. Tell me if you have an idea about. Thanks EDIT: i make it works with some modification of foreman_host.py, i can send the code to anyone who need it.

evgeni commented 4 years ago

with all the work @mdellweg did, I think when we have closed out https://github.com/theforeman/foreman-ansible-modules/issues/647 we can also safely close this one, right?

evgeni commented 4 years ago

step3 has been completed in #745

now f_host is only missing the following params:

is that a new issue, or shall we put that here?

Fobhep commented 4 years ago

IMHO we can close this and create a new one for that.

evgeni commented 4 years ago

interfaces: https://github.com/theforeman/foreman-ansible-modules/issues/757 the others: https://github.com/theforeman/foreman-ansible-modules/issues/758

closing :fireworks: