This is a sampling of yaml experiments working with and without Ansible to test capabilities and see how the YAML translates.
NOTE: YAML version is 1.1, that's what Ansible wants.
It's beneficial to brew install node
and npm install -g js-yaml
to use this.
alias jsonpp='python -m json.tool'
alias jsontoyaml='ruby -ryaml -rjson -e "puts YAML.dump(JSON.parse(STDIN.read))"'
alias yamltojson='ruby -rjson -ryaml -e "puts JSON.pretty_generate(YAML.load(STDIN.read))"'
if parsing fails, error message shown else the yaml is output in json
js-yaml yaml_vars_demo.yml
js-yaml yaml_vars_demo.yml | jsontoyaml
This is noted at the header of playbook.yml
# run the playbook on localhost (that's what "," yields)
ansible-playbook -i "," playbook.yml -v