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

Support assigning organizations #365

Closed Fodoj closed 4 years ago

Fodoj commented 5 years ago

Most of resources belong to one or more organizations. According to API spec it can be set as organization_ids param. Opening this issue so that lack of organization assigning support is tracked.

I think we could just make it a global parameter, like foreman server connections, but I didn't check if really all resources have organizations association.

I'd be happy to contribute this feature, but I will be able to start working on it once we agree on how it shall be implemented (per resource or some common param).

evgeni commented 4 years ago

@Fodoj I'd like to have this too. did you already start working on this? or shall I try to fit that into my schedule?

Fodoj commented 4 years ago

I didn't, feel free to pick this up. I won't have capacity to do this in upcoming weeks

evgeni commented 4 years ago

Quick grep suggests the following modules are missing support for organization/locations, but I didn't verify if the API actually allows it (yet):

evgeni commented 4 years ago

So I had a look at the api docs and the models in foreman, and it seems "realm" is the only module that could support taxonomies and does not today.

Notes what I did:

In foreman.git:

% git grep -lE "^\s+include Taxonomix"
auth_sources/auth_source_external.rb
auth_sources/auth_source_ldap.rb
compute_resource.rb
domain.rb
environment.rb
filter.rb
hostgroup.rb
http_proxy.rb
medium.rb
provisioning_template.rb
ptable.rb
realm.rb
report_template.rb
smart_proxy.rb
subnet.rb
user.rb

In foreman-ansible-modules.git:

% git grep -l 'foreman\.taxo'
foreman_auth_source_ldap.py
foreman_compute_resource.py
foreman_domain.py
foreman_environment.py
foreman_hostgroup.py
foreman_installation_medium.py
foreman_job_template.py
foreman_provisioning_template.py
foreman_ptable.py
foreman_role.py
foreman_subnet.py
foreman_user.py

Manual diff leaves me with:

auth_sources/auth_source_external.rb
filter.rb
http_proxy.rb
realm.rb
report_template.rb
smart_proxy.rb

and from that, realm is the only one we have a module for.

So, @Fodoj, which modules were missing the assignment for you? :)

BTW, I did move that to common code in https://github.com/theforeman/foreman-ansible-modules/pull/637

evgeni commented 4 years ago

and realm gets taxonomy support in https://github.com/theforeman/foreman-ansible-modules/pull/671 :)

evgeni commented 4 years ago

Ping @Fodoj, which modules do you miss?

Fodoj commented 4 years ago

Can't say from the tip of my head, at this point it seems like everything is already there.. Closing this issue, thanks a lot! Taxonomy PR looks really good.

evgeni commented 4 years ago

Thanks for checking!