In Ansible 2.4.2.0, can I override the SSH key set in inventory with ansible_ssh_private_key_file
on command line? It is not possible with --private-key
option as reported on this issue: Command-line flags (variable weight) not respected (bug or a feature?)
The inventory file:
[group1]
instance1 ansible_host=host1 ansible_user=user1 ansible_ssh_private_key_file=~/.ssh/user1host1-id_rsa
Command line:
ansible-playbook playbook1.yml --private-key=some_other-id_rsa