Skip to main content
hello,I want to use the ansible tower cli plugin and discovery mode to automatically add hosts in centreon.For each host, the variables reported by the discovery plugin do not report the IP address of the machine:

      {
         "inventory_name" : "vCenter BE_Linux",
         "description" : "imported",
         "groups" : >
            {
               "name" : "guests",
               "id" : 422
            },
            {
               "name" : "rhel8_64Guest",
               "id" : 428
            }
         ],
         "inventory_id" : 8,
         "name" : "107501lctm",
         "enabled" : true,
         "type" : "host",
         "id" : 10816
      },

However, when you query the Tower API, it is possible to obtain the IP of the machine, it is found in the 'variables' field which are the facts and which are not used by the plugin.here is an example of feedback from the Tower API:
{    "id": 11010,    "type": "host",    "url": "/api/v2/hosts/11010/",    "related": {        "named_url": "/api/v2/hosts/WANGERSPSPDC1++vCenter BE_Linux++Default/",        "variable_data": "/api/v2/hosts/11010/variable_data/",        "groups": "/api/v2/hosts/11010/groups/",        "all_groups": "/api/v2/hosts/11010/all_groups/",        "job_events": "/api/v2/hosts/11010/job_events/",        "job_host_summaries": "/api/v2/hosts/11010/job_host_summaries/",        "activity_stream": "/api/v2/hosts/11010/activity_stream/",        "inventory_sources": "/api/v2/hosts/11010/inventory_sources/",        "smart_inventories": "/api/v2/hosts/11010/smart_inventories/",        "ad_hoc_commands": "/api/v2/hosts/11010/ad_hoc_commands/",        "ad_hoc_command_events": "/api/v2/hosts/11010/ad_hoc_command_events/",        "ansible_facts": "/api/v2/hosts/11010/ansible_facts/",        "inventory": "/api/v2/inventories/8/"    },    "summary_fields": {        "inventory": {            "id": 8,            "name": "vCenter BE_Linux",            "description": "",            "has_active_failures": false,            "total_hosts": 246,            "hosts_with_active_failures": 0,            "total_groups": 20,            "has_inventory_sources": true,            "total_inventory_sources": 1,            "inventory_sources_with_failures": 0,            "organization_id": 1,            "kind": ""        },        "user_capabilities": {            "edit": true,            "delete": true        },        "groups": {            "count": 2,            "results":                  {                    "id": 422,                    "name": "guests"                },                {                    "id": 433,                    "name": "windows7Server64Guest"                }            ]        },        "recent_jobs": t]    },    "created": "2023-12-19T10:17:17.121535Z",    "modified": "2023-12-19T10:17:17.121544Z",    "name": "WANGERSPSPDC1",    "description": "imported",    "inventory": 8,    "enabled": true,    "instance_id": "5017c686-ca23-fbe3-b279-72830f61e65f",    "variables": "{\"ansible_host\": \"55.37.75.86\", \"ansible_ssh_host\": \"55.37.75.86\", \"ansible_uuid\": \"6e5f58b4-692a-5df2-ab14-8d51c1813112\", ……….}",    "has_active_failures": false,    "has_inventory_sources": true,    "last_job": null,    "last_job_host_summary": null,    "ansible_facts_modified": null}

 

My question is simple, is it possible to retrieve this IP in the 'variables' field?Currently, the plugin information providing only the name of the host does not allow the machines to be monitored.THANKS

Philippe

NewIn Backlog

Hi,

Thanks for your interest in Centreon.

It seems to be a missing feature in Ansible Tower discovery.

We will work on this enhancement as soon as possible, it has been added to our backlog.


Hello :)

Can you confirm that the improvement added in the October release has met your request?


Hello,

This was indeed the expected result.
Perfect, thank you