根据Ansible 配置设置的文档,我们可以放置ansible.cfg在我们正在处理的项目的当前目录中,Ansible 将按照上面链接中指定的顺序搜索配置文件。
但是,ansible 似乎无法正确解析ansible.cfg我的项目目录中的文件。我不确定,但我认为它必须与 Ini ConfigParser 一起使用
ansible 2.6.3
config file = /Users/pnotes/Code/Terraform/Blog/ansible/ansible.cfg
configured module search path = ['/Users/pnotes/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/pnotes/.pyenv/versions/3.6.4/lib/python3.6/site-packages/ansible
executable location = /Users/pnotes/.pyenv/versions/3.6.4/bin/ansible
python version = 3.6.4 (default, Feb 26 2018, 21:07:35) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
Run Code Online (Sandbox Code Playgroud)
“ansible-config dump --only-changed”的输出
Error reading config file (/Users/pnotes/Code/Terraform/Blog/terraform/ansible.cfg): File contains no section headers.
file: '/Users/pnotes/Code/Terraform/Blog/terraform/ansible.cfg', line: 3
'vault_password_file = ~/.vault_pass.txt\n'
Run Code Online (Sandbox Code Playgroud)
macOS 高山脉 …
ansible ×1