Open gardar opened 3 years ago
I wonder if that's related to https://projects.theforeman.org/issues/32661 which was recently fixed.
But will try to reproduce regardless
I believe this is the same issue as https://bugzilla.redhat.com/show_bug.cgi?id=1962386
paging @phess , let me know if you have some interest/bandwidth to look into it together :)
I believe this is the same issue as https://bugzilla.redhat.com/show_bug.cgi?id=1962386
paging @phess , let me know if you have some interest/bandwidth to look into it together :)
Yes to interest, potential Yes to bandwidth. Thank you @wbclark for the offer! ;-)
Just wanted to voice that this is still an issue with the 3.9.0
version of the Ansible collection paired with Foreman 3.5.1. I generate a handful of nested hostgroups via Ansible without touching any installation media parameters except for Arch, OS, and PTable. Despite the UI showing the kickstart repository as selected in the Web UI as values provided from the lifecycle environment and content view, trying to provision any system with the theforeman.foreman.host
module where build: true
is set fails immediately. Example:
- name: Create host in Foreman
register: foreman_host
theforeman.foreman.host:
server_url: "{{ foreman_url }}"
username: "{{ foreman_username }}"
password: "{{ foreman_password }}"
# organization: "example"
# location: "{{ hostvars[inventory_hostname].location }}"
name: "{{ inventory_hostname }}.example.com"
hostgroup: "{{ hostvars[inventory_hostname].hostgroup }}"
compute_profile: "{{ hostvars[inventory_hostname].compute_profile }}"
build: true
This will first error out with:
FAILED! => {"changed": false, "msg": "Error while performing create on hosts: The following required parameters are missing: host[organization_id], host[location_id]"}
which after providing (un-commenting in the above) turns into this:
FAILED! => {"changed": false, "error": {"errors": {"medium_id": ["can't be blank"]}, "full_messages": ["Medium can't be blank"], "id": null}, "msg": "Error while performing create on hosts: 422 Client Error: Unprocessable Entity for url: https://foreman.example.com/api/hosts"}
Just going into the Web UI and "saving" each host group without making any modifications makes this go away...
SUMMARY
When creating a nested hostgroup the installation media is not inherited from the parent group while other values such as architecture and operating system are inherited just fine.
This is actually the same that happens when you create a group in the gui, the installation media is not inherited when you create a nested group, but if you edit the group and save it again without making any changes the installation media gets populated. This however does not happen with the ansible module, if I run the task again it does not re save the group and thus does not populate the installation media in the same way as the guy action does.
I thought this was a bug in foreman/satellite but according to redhat this is the expected behavior: https://bugzilla.redhat.com/show_bug.cgi?id=1619257 so I think this is something that the module needs to handle.
ISSUE TYPE
ANSIBLE VERSION
COLLECTION VERSION
KATELLO/FOREMAN VERSION
STEPS TO REPRODUCE
Create a parent hostgroup that has a operating system version set and then create a child (nested) group that inherits the operating system values from the parent.
EXPECTED RESULTS
I expect to have three groups:
ACTUAL RESULTS
I get the following groups: