Question around importing inventory
BondAnthony opened this issue · comments
When running ansible-inventory it creates a config file under ~/.ansible/ansible-inventory.cfg. How do I prevent that file from being overwritten? I'm trying to set my file_backend to a different file and directory so I don't have to import it each time.
The file ~/.ansible/ansible-inventory.cfg
should never be overwritten. It is created only if it does not exist, as you can see here. Could you please tell me what version of ansible-inventory
are you using?
I'm running version 0.3.9 and I'm primarily using this to generate the json file. I have another script that ansible is calling to actually use the inventory.
Thanks for the quick response.
I am afraid that ansible-inventory
does not generate a json file from the basic inventory syntax (ini syntax). If you want to do that you might want to take a look here: https://gist.github.com/jtyr/5213fabf2bcb943efc82f00959b91163
No I'm adding the data via your batch command line interface. Using the CLI it produces a json document in the ~/.ansible/inventory.json directory by default. I'm moving this json file to a different directory then telling a different inventory script to be used by Ansible.........
Sorry to bug you! I I just saw my error in the Vagrantfile while dynamically creating the ~/.ansible/ansible-inventory.cfg file. You're right it works without a problem and doesn't overwrite the config file.
Have you been able use encrypted variables with your CLI?
No worries. Glad it is fixed.
I have not tried as I personally use .yml
files for the vault variables. Is that what is keeping you from using ansible-inventory
? Some feedback (good or bad) would be awesome :)
I have an encrypted variable set within it but haven’t actually tested out using it. I did notice passing a long jdbc url forces me to wrap it in quotes. Problem is when I dump the variables the string is then double quoted. Once I start using the inevntory I’ll provide more feedback.
The inventory works well on my vagrant box for development. Problem comes about when I’m on my dedicated Ansible host that doesn’t have python3
If you could open a ticket for every problem you find that would help a lot.
It seems that python3 is the future and it is coming preinstalled in major distributions so I chose python3 over python2