Hello, Ansible users!
I am trying to make a group of variables persistent on hosts, preferably as a text file.
I was using puppet+facter before and now I’m looking for a native way to accomplish this with ansible.
My task:
- Facts are being initialised only once, when host is provisioned
- Facts are stored as a text file on remote host and are reusable from any other scripts on that host
- Facts are automatically read into ansible vars from file once ansible connects to a host
At this moment I’ve tried following:
-
‘include_vars’ works only with local file
-
‘set_fact’ facts are not persistent
-
fact caching saves facts on local machine
-
‘facter’ module cannot store facts on host, it can only retrieve existing
It looks like that my task can be accomplished with a custom inventory script, but before I spend a week on this, I’m asking here.
Thanks!