Ansible Tower Inventory Overwrite Option

Hi Experts,

As per below information, when I enable overwrite option with source inventory from project. Ansible will be overwritten on the hosts that added by Morpheus when it sync with project inventory.
As per my test outcome, it didn’t overwrite.

Morpheus version: 6.2.2
Ansible AWX: 23.0.0

Ansible: Created inventory file and added hosts record in inventory.ini file that belong to the project.
Ansible: Configure source inventory from the project.
Ansible: Perform Sync inventory and hosts are added in inventory from project.
Morpheus: Provisioned the instance to the cloud that enabled Ansible tower and inventory. Morpheus added host to the inventory.
Ansible: Sync the inventory from project and host record that added by Morpheus is still exist.

Any feedback?

Regards,
Aung

Hi Anug,

If the host still exist in source when the sync is actioned from project, the host entry would be present. Do you see 2 host entries in the invenotry, if ‘yes’ are they in the same group?

Thanks,
Anish.

Hello @aabraham,

I didn’t use the group option. Yes, I saw 2 host entries.(one from Project source and another one from Morpheus after instance provisioned).

Regards,
Aung

Are you executing an ansible tower task in the provision or pos-provision phase of the instance provisioning?

Thanks,
Anish

I am executing post-provision phase of the instance.

Thanks,
Aung

Hi Anug,

Morpheus will add the host to the inventory as part of the post provision task execution. Are you expecting morpheus to check if a host with the name exists before adding it?

Thanks
Anish.

Hello Anish,

As per article, any hosts added by Morpheus will be overwritten when we run inventory sync from Project if we enabled overwrite option. It is expected outcome right? But it didn’t happen in my testing scenario.

And also Morpheus will still add the host to the inventory when we run only Ansible Tower automation task/workflow (Library > Automation > Execution). Is it?

If we expect morpheus to check if a host with the name exists before adding it, how we can achieve? do we need to run the task which perform inventory hosts check using Ansible API or other options?

Thanks,
Aung

Hello @aabraham,
May I get your feedback please?

Regards,
Aung