I had enabled fact caching using below commands when i was earlier using ansible 2.9 with python 2.7 (not sure about minor version though i know major version was python 2.xx) in WSL linux.
ASA facts module didn’t work with ansible 2.9. So i had to upgrade to ansible 2.11.2 with pythin 3.7.3 to make the module to work. After that, facts caching works only partially. Before upgrade, i could see the output of ios_facts (ios_facts module is equivalent to ‘gather facts: true’) and custom variables in the file created for the device. After ansible upgrade, the file contains only the outout of ios_facts and not that of custom variables.
I am using jsonfile fact cahing plugin and the output of each device gets saved in a file in below mentioned location and the file would have the name that we specify as inventory_hostname.
Is there any bug that makes fact caching incompatible with ansible 2.11 or would the upgrade from ansible 2.9 with python 2 to ansible 2.11 with pyton 3.7 have introduced any bug - would uninstalling WSL linux and ansible and re-installing them from scratch help?
There should not be an incompatible change,I tested with other facts
plugins (no IOS devices here) and I don't see the issue, can you
provide more details?
Below is my playbook. As you can see, i am gathering device facts (using ios_facts) and also saving the output of a output in a custom variable. I have the given the contents of file saved by fact cache plugin below the script, as you can see only the ios_facts output is saved.
I changed fact cache pluigin from jsonfile to yaml, still the same issue. So iam wondering now if facts cache plugin was meant to only store output of device facts (like ios_facts) and not store contents of a custom variable?
In the script mentioned earlier, the output of a command which is stored as custom variable ‘show_bootinfo’ would be stored in the file (pasting that part of the script below) and i have viwed the output in the file. But i no longer see output of custom variables stored in the file created by fact cache plugin. I see only the output of device facts (ios_facts) being stored.
When i run the script with -vvvv option, below is what is displayed for the TASK which creates custom variable. Unfortunately, i don’t have the option to provide the difference in the data sets as i uninstalled ansible and did a fresh installation hoping that may fix this issue. So whatever info i had seen earlier is lost.
Now i wonder if facts cache plugin was meant to only store output of device facts (like ios_facts) or would it store contents of a custom variable?
name: GATHER BOOT INFO
asa_command:
commands: “sh run boot system”
When i run the script with -vvvv option, below is what is displayed for the TASK which creates custom variable. Unfortunately, i don't have the option to provide the difference in the data sets as i uninstalled ansible and did a fresh installation hoping that may fix this issue. So whatever info i had seen earlier is lost.
So, the installation procedure you've chosen is getting in the way.
From terms like "Uninstalling", "fresh installation" etc I take it
that you are using some OS package manager to install ansible/python.
In order to diagnose potential differences between ansible versions,
you should have two environments that ONLY differ in their ansible
version.
I found that python virtualenvs are a great way to do this. They allow
you to have multiple ansible versions next to each other, potentially
multiplied by whatever python version(s) you might have (for example
through pyenv).
So, my suggestion is to set up two virtualenvs with the ansible
versions you suspect differ, and then run the exact same
playbook/inventory/etc, and then compare output.
See https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-and-upgrading-ansible-with-pip