facts cache empty after inventory update

Hi,

Most of my playbooks have “enable facts cache” but it looks like the facts get deleted after an inventory update.
Is there a way to keep the old fact cache?

Background:

I’ve got an inventory with multiple sources and I update them in a work flow. After updating all vcenter inventories I add variables from a project.
When running this it deletes all the facts from the host like it has deleted the host and remade it.

Kind regards

Hi,

Do you mean the facts are replaced with newer facts for those hosts, or that they are deleted permanently (until you re-run a job that has fact cache enabled)? Also which version of AWX are you using?

AWX Team

Hi,

I have this same issue.

In earlier versions (eg. 17.1.0) unticking ‘Overwrite’ in the inventory source would keep the facts when an inventory sync is run.
But in version 21.1.0, facts are always overwritten when the inventory source is sync’d.

Thanks

My mistake - it doesn’t seem to be an inventory source sync removing the facts…they’re just not there after a certain amount of time.
We use smart inventories populated using custom facts - these inventories are empty in the morning, but repopulate as soon as I run a job to gather facts again.

Let me know if you need any more info for this issue…

a similar issue is being reported here https://github.com/ansible/awx/issues/6140

feel free to also including helpful information on the issue to get better traction

AWX Team

Sorry for the slow reply - thanks will check it out.

I added the following comment to the GitHub issue a couple of weeks ago but no response as yet.

We use custom Ansible facts to populate smart inventories in AWX. This works fine up to AWX 17.1.0, but facts seem to disappear (the smart inventories keep emptying) in any version since using K8s. Currently I have version 21.4.0.

I can run a job to collect facts, and the smart inventories look good. After what seems like a random time (sometimes minutes, other times can be an hour or more) the smart inventories are empty again.
I have tested running inventory syncs with different update options (overwrite, overwrite variables)…neither seem to wipe the facts. Are there any other settings or logs I can check? We rely heavily on the smart inventories.

If there is any info I can provide to help with this please let me know - we’re currently having to rely on an old AWX system (17.1.0) to make use of smart inventories.

Thanks
Rob

I no longer got this problem after an upgrade :slight_smile:

No such luck for me so far :frowning: