Bug 1878693
Summary: | Unable to perform image based deployment using hosts module from Red Hat Satellite Ansible Collections | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Sayan Das <saydas> |
Component: | Ansible Collection | Assignee: | Evgeni Golov <egolov> |
Status: | CLOSED ERRATA | QA Contact: | Peter Ondrejka <pondrejk> |
Severity: | high | Docs Contact: | |
Priority: | unspecified | ||
Version: | 6.7.0 | CC: | egolov |
Target Milestone: | 6.8.0 | Keywords: | Triaged |
Target Release: | Unused | ||
Hardware: | All | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | ansible-collection-redhat-satellite-1.3.0 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2020-10-27 13:09:00 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Sayan Das
2020-09-14 11:09:24 UTC
can you try the following patch against the host module? diff --git plugins/modules/host.py plugins/modules/host.py index 99ec2d07..e96110f8 100644 --- plugins/modules/host.py +++ plugins/modules/host.py @@ -221,7 +221,7 @@ def main(): owner_group=dict(type='entity', resource_type='usergroups', flat_name='owner_id'), owner_type=dict(type='invisible'), provision_method=dict(choices=['build', 'image', 'bootdisk']), - image=dict(type='entity'), + image=dict(type='entity', scope=['compute_resource']), compute_attributes=dict(type='dict'), ), mutually_exclusive=[ Hello Evgeni,
Yes, that change works fine now. I can get the host created now.
$ diff collections/ansible_collections/redhat/satellite/plugins/modules/host.py collections/ansible_collections/redhat/satellite/plugins/modules/host.py_bkp
191c191
< image=dict(type='entity', scope=['compute_resource']),
---
> image=dict(type='entity'),
This resource_info module still fails to list the images with following task.
~~
- name: Get image resources
redhat.satellite.resource_info:
username: "{{ satellite_username }}"
password: "{{ satellite_password }}"
server_url: "{{ satellite_url }}"
organization: "{{ satellite_organization }}"
resource: images
register: images
ignore_errors: true
~~
Am i missing something in the task ?
(In reply to Sayan Das from comment #3) > This resource_info module still fails to list the images with following task. > ~~ > - name: Get image resources > redhat.satellite.resource_info: > username: "{{ satellite_username }}" > password: "{{ satellite_password }}" > server_url: "{{ satellite_url }}" > organization: "{{ satellite_organization }}" > resource: images > register: images > ignore_errors: true > ~~ > > Am i missing something in the task ? Yeah. So "image" objects can't be searched "as is". You need to search them scoped by another entity (that's also what the patch for the host module does, it tells our library "go, search by compute_resource"). resource_info is a rather "dumb" module, so it doesn't know that, and just throws an error at you "missing param ''operatingsystem_id'' in parameters" Now images can be scoped by three things: operatingsystems, architectures and compute_resources. I must admit scoping them by OS or arch is rather confusing, so both the "image" module and the "host" module (after the above patch) forces scoping by CR. To do the same with "resource_info", you could do smth like that: - name: Get image resources redhat.satellite.resource_info: username: "{{ satellite_username }}" password: "{{ satellite_password }}" server_url: "{{ satellite_url }}" organization: "{{ satellite_organization }}" resource: images params: compute_resource_id: 1234 register: images You'd obviously need to know the numeric ID of the CR, which you can find using… resource_info ;) FWIW, we (eng) don't consider that a bug in resource_info, but there is a long term goal to have specific _info modules for individual entities. <insert something about finite time problems here> ;) Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Important: Satellite 6.8 release), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2020:4366 |