我能夠在group_vars定義哈希(字典)像下面/所有:如何在安全庫存文件中定義散列(dict)?
region_subnet_matrix:
site1:
region: "{{ aws_region }}"
subnet: "subnet-xxxxxxx"
zone: "{{aws_region}}a"
site2:
region: "{{ aws_region }}"
subnet: "subnet-xxxxxxx"
zone: "{{aws_region}}b"
,但對我的生活,我無法弄清楚如何定義它在hosts文件
[all:vars]
region_subnet_matrix="{
site1:
region: "{{ aws_region }}"
subnet: "subnet-xxxxxxx"
zone: "{{aws_region}}a"
site2:
region: "{{ aws_region }}"
subnet: "subnet-xxxxxxx"
zone: "{{aws_region}}b"
}"
我知道這是不正確的,但我不知道正確的方法。請有人賜教我嗎?
此外'host_vars'文件夾是[Ansible最佳實踐](http://docs.ansible.com/playbooks_best_practices.html#directory-layout)目錄佈局的一部分。 – kalefranz