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

Module outputs list of entities even if only one entity was managed #583

Open Fodoj opened 4 years ago

Fodoj commented 4 years ago
SUMMARY

Commit in question: https://github.com/theforeman/foreman-ansible-modules/commit/72376b0f42eb74919604c00f4cb89fabb599ba9f

Before that it was possible to register variable, for example usergroup like this:

register: usergroup

And then use it like this:

usergroup['entity']['id']

Now it's a bit more verbose:

usergroup['entity']['usergroups'][0]['id']

Which is a bit too much, given that only one resource is managed at a time.

ISSUE TYPE
Fodoj commented 4 years ago

/cc @evgeni

mdellweg commented 4 years ago

Can we always report the main entity at result['entity']['id'] and report the others as subentities / elsewhere?