Open gvde opened 2 years ago
O.K. I think I've found the reason. The problem is here: https://github.com/theforeman/foreman-ansible-modules/blob/770800e6a4ecf3092252936371f7ad03a19dd8d1/plugins/modules/hostgroup.py#L197-L198
It expects an environment_id. However, it's a nested hostgroup and it inherits the environment from the parent hostgroup. Due to that, environment_id is null:
$ curl -n https://foreman8.example.com/api/hostgroups/4 | python3 -m json.tool
...
"parameters": [],
"environment_id": null,
"environment_name": "production",
"inherited_environment_id": 1,
"template_combinations": [],
...
I have double-checked: I have chose a specific environment in the hostgroup and during the next run it sets the additional puppetclass.
And during hostgroup creation it's the same: if I set an environment for the nested group it adds the additional puppetclasses. If I set no environment (i.e. it inherits it from the parent hostgroup) it doesn't work.
SUMMARY
Running against a katello 4.3 or 4.4 server my playbook doesn't set puppet classes for nested hostgroups.
It creates the host group org_dns with centos7-base as parent and as expected almost everything is inherited from centos7-base. The group is inheriting the two classes org_base and org_ipa as well but it doesn't add org_dns
ANSIBLE VERSION
COLLECTION VERSION
Using latest version 3.3.0 from ansible-galaxy with some patches from pull requests.
KATELLO/FOREMAN VERSION
STEPS TO REPRODUCE
See playbook above.
EXPECTED RESULTS
Add puppet classes to group.