.├── inventory
│ ├── aws-dev│ │ ├── aws-dev│ │ ├── ec2.ini│ │ ├── ec2.py│ │ └── group_vars│ │ ├── all│ │ │ ├── all.yml│ │ │ └── secrets.yml│ │ ├── security_group_app.yml│ │ └── security_group_util│ │ ├── secrets.yml│ │ └── security_group_util.yml│ ├── aws-prod│ │ ├── aws-prod│ │ └── group_vars│ │ └── all│ │ ├── all.yml│ │ └── secrets.yml│ └── vmware-dev│ ├── group_vars│ │ ├── all│ │ │ ├── all.yml│ │ │ └── secrets.yml│ │ └── tag_role_app.yml│ ├── vmware-dev│ ├── vmware.ini│ └── vmware.py├── roles├── aws-configure.yml├── aws-provision.yml├── vmware-configure.yml└── vmware-provision.yml
Have you thought about using role default variables instead? If all environments have the same setting, this would be simpler. Role default variables can then be overridden for specific groups in the group vars file.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/306e15e9-3a22-4c24-a346-791029131072%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Problem with a vars plugin is that you'll have to specify it in each playbook. New idea: you could put another inventory script in your dir that evaluates your common file.
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/T9RWNQbLRWs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/15a4f5b0-b92b-4005-9955-1eea03d8b39c%40googlegroups.com.
python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < all.yml > all.json
Some of the variables in the all.yml are also templated from other variables - would they be parsed properly if coming in from an inventory script?
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/T9RWNQbLRWs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3fbb98b7-de69-4ae3-9f3d-16b740bd7f4e%40googlegroups.com.
.├── inventory
│ ├── common_vars.yml
│ ├── aws-dev│ │ ├── aws-dev
│ │ ├── common_vars.sh
│ │ ├── ec2.ini│ │ ├── ec2.py│ │ └── group_vars│ │ ├── all│ │ │ ├── all.yml│ │ │ └── secrets.yml│ │ ├── security_group_app.yml│ │ └── security_group_util│ │ ├── secrets.yml│ │ └── security_group_util.yml│ ├── aws-prod
│ │ ├── aws-prod
│ │ ├── common_vars.sh
│ │ ├── ec2.ini│ │ ├── ec2.py│ │ └── group_vars│ │ └── all│ │ ├── all.yml│ │ └── secrets.yml
│ └── vmware-dev│ ├── group_vars│ │ ├── all│ │ │ ├── all.yml│ │ │ └── secrets.yml
│ │ └── tag_role_app.yml
│ ├── common_vars.sh
│ ├── vmware-dev│ ├── vmware.ini│ └── vmware.py├── roles├── aws-configure.yml├── aws-provision.yml├── vmware-configure.yml└── vmware-provision.yml
#!/usr/bin/env bash
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )# echo $DIRpython -c 'import sys, yaml, json; json.dump({"all": {"vars": yaml.load(sys.stdin) } }, sys.stdout, indent=4)' < $DIR/../common_vars.yml # > all.json
Thanks for sharing! Glad I could help. :)
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/T9RWNQbLRWs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c21d0da1-f461-4ff6-8a5a-dd49f87b17de%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/T9RWNQbLRWs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7491dcf2-4674-4f1b-be13-399ce4d9ca30%40googlegroups.com.
#! /usr/bin/env python
import os, sys, yaml, jsonsrcfile = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..', 'common_vars.yml'))with open(srcfile) as f: json.dump({"all": {"vars": yaml.load(f) } }, sys.stdout, indent=4)