Bug 1911670 - redhat.satellite.host fails to deploy a new VM if image_id is not passed in compute attributes
Summary: redhat.satellite.host fails to deploy a new VM if image_id is not passed in c...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Ansible Collection
Version: 6.8.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: 6.10.0
Assignee: Evgeni Golov
QA Contact: Vladimír Sedmík
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-12-30 16:14 UTC by Rudnei Bertol Jr.
Modified: 2024-03-25 17:42 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 14:09:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github theforeman foreman-ansible-modules pull 1215 0 None closed pass the UUID of an image to the compute resource when creating a host 2021-05-04 10:02:08 UTC
Red Hat Product Errata RHSA-2021:4702 0 None None None 2021-11-16 14:09:56 UTC

Description Rudnei Bertol Jr. 2020-12-30 16:14:36 UTC
Description of problem:

redhat.satellite.host resource cannot create the host on the Satellite, based on the host group predefinitions, when using image-based deploy on Azure, as the following example.

~~~
- hosts: localhost
  tasks:

    - name: "Create a host {{ hostname }} on Azure"
      redhat.satellite.host:
        username: "admin"
        password: "mysecpassword"
        server_url: "https://satellite.hostname.com"
        name: "{{ hostname }}.{{ domain }}"
        domain: "{{ domain }}"
        organization: "Default Organization"
        validate_certs: no
        location: "Default Location"
        hostgroup: Azure_Deploy
        build: true
        state: present
~~~

Version-Release number of selected component (if applicable):

ansible-collection-redhat-satellite-1.3.0-1.el7sat.noarch

How reproducible:

Try to deploy a host-based on an image on Azure via Satellite using the host resource.

Steps to Reproduce:
1.
2.
3.

Actual results:

It fails with the following error.

~~~
fatal: [localhost]: FAILED! => {"changed": false, "error": {"errors": {"base": ["Failed to create a compute AZURE_RBERTOL_FREE (Azure Resource Manager) instance nuevo.gsslab.rdu2.redhat.com: undefined method `split' for nil:NilClass\n "]}, "full_messages": ["Failed to create a compute AZURE_RBERTOL_FREE (Azure Resource Manager) instance nuevo.gsslab.rdu2.redhat.com: undefined method `split' for nil:NilClass\n "], "id": null}, "msg": "Error while performing create on hosts: 422 Client Error: Unprocessable Entity"}
~~~

Expected results:

The host should be created.

Additional info:

Comment 5 Evgeni Golov 2021-01-07 11:13:53 UTC
Okay, I think I found the culprit, even tho I am not totally sure how to best fix it.

To deploy on Azure, we need to provide a boot image (like 'marketplace://RedHat:RHEL:7-RAW:latest' or similar), but neither the HG nor the Compute Profile does that automatically for us.
Now the Ansible module has an "image" param, but setting it doesn't help, as that somehow is not properly translated to Azure. However, setting "compute_attributes: {image_id: 'marketplace://RedHat:RHEL:7-RAW:latest'}" helps.

Absolutely nothing we should require our users to do (they should set "image: RHEL7" and the rest should be looked up magically).

There is a similar-ish workaround in hammer: https://github.com/theforeman/hammer-cli-foreman/commit/f163dd9fc9a232f711621f81a16752624edd5de7

Comment 6 Vladimír Sedmík 2021-09-17 15:10:11 UTC
Successfully deployed an image-based host on Azure without need to provide the 'image_id' (only 'image' was defined in the playbook)

Verified at:
Satellite 6.10.0 snap 18
ansible-collection-redhat-satellite-2.1.2-1.el7sat.noarch

Comment 9 errata-xmlrpc 2021-11-16 14:09:38 UTC
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 (Moderate: Satellite 6.10 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-2021:4702


Note You need to log in before you can comment on or make changes to this bug.