我无法在简单的`local.yml'中访问group_vars/all
中定义的变量的值。剧本。
我有目录结构:
/group_vars
/all
local.yml
group_vars/all
的内容:
key_name: bar
local.yml
的内容:
- name: Local example
connection: local
gather_facts: no
tasks:
- debug: msg="Key is {{ key_name }}"
这是我如何运行剧本:
ansible-playbook -i localhost, local.yml
错误消息:
PLAY: Local example *************************************************************
TASK [debug msg=Key is {{ key_name }}] ******************************************
fatal: [localhost]: FAILED! => {"msg": "ERROR! the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'key_name' is undefined", "failed": true}
NO MORE HOSTS LEFT **************************************************************
PLAY RECAP **********************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1