Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-42761

Unable to update or modify Host using theforeman.foreman.host module

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • 6.18.0
    • Ansible Collection
    • None
    • False
    • sat-rocket
    • None
    • None
    • None
    • None

      Description of problem:

      When using 'theforeman.foreman.host' module with the following task:

      (for ex, the following task is to modify network interface of the host) 

      ~~~~~~~~

      • name: modify host entry in Satellite server
         theforeman.foreman.host:
          username: '{{ satellite_user }}'
          password: '{{ satellite_password }}'
          server_url: 'https://{{ satellite_server }}'
          name: '{{ inventory_hostname_short }}.{{ dns_domain }}'
          state: present
          activation_keys: '{{ satellite_activation_key }}'
          build: no
          content_source: '{{ satellite_server }}'
          content_view: '{{ satellite_content_view }}'
          lifecycle_environment: 'Library'
          architecture: 'x86_64'
          operatingsystem: 'RedHat {{ ansible_distribution_version }}'
          organization: '{{ satellite_organization }}'
          validate_certs: no
          medium: '{{ satellite_medium }}'
          managed: yes
          location: 'location_name'
          hostgroup: 'hg_name'
          interfaces_attributes:
           - type: "interface"
            primary: true
            managed: yes
            name: '{{ inventory_hostname_short }}'
            mac: '{{ ansible_default_ipv4.macaddress }}'
            ip: '{{ ansible_default_ipv4.address }}'
            domain: '{{ dns_domain }}'
         delegate_to: 'localhost'
         no_log: false
         ignore_errors: true

      ~~~~~~~~~~

       

      The module returns the following error even though Content View and Lifecycle environment is provided: 

      ~~~~~~~~~~

      fatal: [de08-lt015 -> localhost]: FAILED! => {"changed": false, "msg": "Failed to ensure entity state: ForemanApiException: Error while performing update on hosts: 422 Client Error: Unprocessable Content for url: https://satellite.example.com/api/hosts/1234 - {'id': 1234, 'errors':

      {'base': ['Content view and lifecycle environment must be provided together']}

      , 'full_messages': ['Content view and lifecycle environment must be provided together']}"}

      ~~~~~~~~~~

       

      How reproducible: 

      Yes

      Is this issue a regression from an earlier version:

       

      Steps to Reproduce:

      1.

      2.

      3.

      Actual behavior:
      Changing a Host update failed with the following error: "Content view and lifecycle environment must be provided together"

      Expected behavior:
      The Host should be updated successfully as per the changes from playbook.

      Business Impact / Additional info:

      The same scenario was working on Satellite v6.17, but failed after upgrading the Satellite to v6.18. 

       

      The issue is similar to Jira -> https://issues.redhat.com/browse/SAT-30221

              Unassigned Unassigned
              rhn-support-tajoshi Tanmayee Joshi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: