Why do I see the message "no foreman.id" variable(s) when syncing an inventory from Satellite on Ansilble Automation Platform?

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.8
  • Red Hat Ansible Tower >= 3.8
  • Red Hat Ansible Automation Platform >= 1.2

Issue

  • When syncing an inventory from Satellite, all my hosts are deleted and then created again.

  • Why do I see the message no foreman.id variable(s) when syncing an inventory from Satellite?

    2021-02-23 03:17:04,158 WARNING  awx.main.commands.inventory_import Host "005a19d57540" has no "foreman.id" variable(s)
    2021-02-23 03:17:04,158 WARNING  awx.main.commands.inventory_import Host "0065aea42d26" has no "foreman.id" variable(s)
    2021-02-23 03:17:04,158 WARNING  awx.main.commands.inventory_import Host "016e290db6e5" has no "foreman.id" variable(s)
    2021-02-23 03:17:04,158 WARNING  awx.main.commands.inventory_import Host "0194430af4e3" has no "foreman.id" variable(s)
    2021-02-23 03:17:04,158 WARNING  awx.main.commands.inventory_import Host "01b3b9ae5891" has no "foreman.id" variable(s)
    2021-02-23 03:17:04,158 WARNING  awx.main.commands.inventory_import Host "01c75b38ecb6" has no "foreman.id" variable(s)
    2021-02-23 03:17:04,158 WARNING  awx.main.commands.inventory_import Host "0239627e2934" has no "foreman.id" variable(s)
    2021-02-23 03:17:04,159 WARNING  awx.main.commands.inventory_import Host "02428de1739b" has no "foreman.id" variable(s)
    2021-02-23 03:17:04,159 WARNING  awx.main.commands.inventory_import Host "03378be62ff0" has no "foreman.id" variable(s)
    2021-02-23 03:17:04,159 WARNING  awx.main.commands.inventory_import Host "03420b6e1984" has no "foreman.id" variable(s)
    2021-02-23 03:17:04,159 WARNING  awx.main.commands.inventory_import Host "03679268fe3e" has no "foreman.id" variable(s)
    

Resolution

  • On all Tower nodes, configure the variable settings.SATELLITE6_INSTANCE_ID_VAR to foreman_id

    # echo "SATELLITE6_INSTANCE_ID_VAR='foreman_id,foreman.id'" >> /etc/tower/conf.d/custom_satellite6_opts.py
    # chown root.awx /etc/tower/conf.d/custom_satellite6_opts.py
    # chmod 640 /etc/tower/conf.d/custom_satellite6_opts.py
    
  • On the inventory source, have this configuration appended to the source vars:

    vars_prefix: 'foreman_'
    
  • For restarting your Controller services on all nodes

    # automation-controller-service restart
    
  • For restarting your Tower services on all nodes

    # ansible-tower-service restart
    

Root Cause

  • When the error message no foreman.id" variable(s) is displayed, which means the variable is no present as a system fact for that particular host.
    System Facts
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.