这里的目的是覆盖库存文件中使用的ansible_password变量,但似乎不起作用。
TASK [Gathering Facts] ******************************************************************************************************************************************************************************************
fatal: [host1]: UNREACHABLE! => {"changed": false, "msg": "ntlm: auth method ntlm requires a password", "unreachable": true}
PLAY RECAP ******************************************************************************************************************************************************************************************************
host1: ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
任何帮助将不胜感激。
事实证明,我可以在库存中使用lookup()函数来执行HC Vault Lookup。 HC Vault中的销售数据以键值对组织。在下面的示例中,我正在寻找的秘密数据存储在“密码”键中。
test:
vars:
ansible_connection: ansible.builtin.winrm
ansible_winrm_server_cert_validation: "ignore"
ansible_user: "domain\\ansibleUsr"
ansible_winrm_transport: "kerberos"
ansible_password: "{{ lookup('community.hashi_vault.hashi_vault', 'secret=mountPoint/data/pathToSecret token_path=/path/to/tokenDir token_file=vaultTokenFile url=https://vault.domain.com:8200 validate_certs=false').password }}"
hosts:
host1