在 Ansible 2.4.2.0 中,我可以使用 ansible_ssh_private_key_file
覆盖 list 中设置的 SSH key 吗?在命令行上? --private-key
不可能对此问题报告的选项:Command-line flags (variable weight) not respected (bug or a feature?)
库存文件:
[group1]
instance1 ansible_host=host1 ansible_user=user1 ansible_ssh_private_key_file=~/.ssh/user1host1-id_rsa
命令行:
ansible-playbook playbook1.yml --private-key=some_other-id_rsa
最佳答案
您可以使用 --extra-vars
覆盖任何变量参数其中takes the priority over variables defined in any other place :
ansible-playbook playbook1.yml --extra-vars="ansible_ssh_private_key_file=some_other-id_rsa"
关于ssh - 我可以在命令行上覆盖 Ansible SSH key list 变量 ansible_ssh_private_key_file 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50526418/