michael-batz / yourCMDB

A flexible asset management tool. See our new OpenSource project based on the idea of yourCMDB: DATAGERRY
https://datagerry.com/yourCMDB
19 stars 6 forks source link

Add columns to last created objects in Home #17

Closed ghost closed 8 years ago

ghost commented 8 years ago

I would like to add some columns to the last created objects in the Home section, for example hostname and management ip. Is there a quick way to do this?

michael-batz commented 8 years ago

In the current version, this is not possible as the different object types don't need to have the same fields. But I understand the use case and so I created a QuickHack, which adds the to fields "management-ip" and "hostname" to the dashlets and the home page. To use it, simply copy the two files (DashletLastChangedObjects.php and DashletNewestObjects.php) from the attached QuickHack.zip to ./web/dashboard. I marked the changes with the "START: QUICKHACK" comment, so if you want to change something, you can find the places there.

This is just a quick hack for the quick way, if you like, we can add a clean and more configurable way in the next release.

ghost commented 8 years ago

Thanks, that's fast. It would be nice if you can add something to the next release 😀 I have a couple of more suggestions/questions but I will send you a private message later today or tomorrow allright?

michael-batz commented 8 years ago

Ok, I'm curious about the questions.

ghost commented 8 years ago

I could not find an option in GitHub to send you a private message :( But I am going to user yourCMDB as part of my Ansible Tower (GUI) replacement. yourCMDB will provide the dynamic inventories to Ansible. Ansible should also update hosts in yourCMDB so it would be nice when I can use the API with hostname instead of ID to update fields of the host.

ghost commented 8 years ago

It would also be nice if I can add custom fields and values to hosts inside the GUI. It would be a lot easier than adding pre-defined fields inside the XML files.

michael-batz commented 8 years ago

Thank you very much for all the feedback.

So, you are using the REST API to update yourCMDB objects? Unfortunately it is not possible at the moment, to identify objects by hostname. The concept of yourCMDB is to be generic. You can define objects on your own by creating a XML structure and the objects don't need to have a hostname, or the hostname don't have to be unique. But would it be helpful for you, to export the yourCMDB object ID as an Ansible host variable, so that you can use the REST API with the ID?

Hmm, there are some thoughts, to move the configuration to the WebUI in the future. But this has not the highest priority at the moment.

So, hope this is helpful for you?

ghost commented 8 years ago

This does not work:

<variable name="hostvar_id">
                <value objecttype="host" fieldname="Id" />
</variable>

Any idea how to get the host ID into the ansible-example.xml?

michael-batz commented 8 years ago

This is not implemented at the moment, but I can extend the AnsibleExporter if this is way that works for you.

ghost commented 8 years ago

If you would do that it would be perfect. I can use the ID for communication to and from Ansible :D

michael-batz commented 8 years ago

Ok, the extension on the exporter is done. For the extension of the start page, I created #21