Reputation: 919
Is it possible to process json file by saltstack that is located on minions using states functionality?
I'm sure that it should be possible to do using jinja's functionality, but can't find any information.
Upvotes: 0
Views: 4305
Reputation: 11970
cp.get_file_str
is what you need.
You can add the following line for example at the top of your state file and will load the file from the minion as a json
.
First it will load it as string
then load_json
filter will convert the string
to json
object so you can handle it like a normal json
.
{% set json_data = salt.cp.get_file_str('/path/to/myfile.json') | load_json %}
Note: That line will be compiled before the state modules.
Upvotes: 7