-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hosts added by add_host
module don't respect ansible_host_key_checking
variable
#1066
Comments
If vanilla respects |
The reason I used a dedicated variable was because the skeleton for But I'm totally fine with hooking to |
I changed the pr to use |
add_host
module don't respect ansible_host_key_checking
variable
I confirm the issue when There are other differences I was unaware of. These may also qualify as bugs. Related differences
Notes to self
Reproduction# issue1066_repro.yml
- hosts: localhost
gather_facts: false
tasks:
- known_hosts: {name: "192.168.1.112", state: absent}
- add_host: {name: ansible-test-100, ansible_host: "192.168.1.112"}
- hosts: ansible-test-100
gather_facts: false
tasks:
- ping: # issue1066_repro2.yml
- hosts: localhost
gather_facts: false
tasks:
- known_hosts: {name: "192.168.1.112", state: absent}
- add_host: {name: ansible-test-100, ansible_host: "192.168.1.112", ansible_host_key_checking: false}
- hosts: ansible-test-100
gather_facts: false
tasks:
- ping: Playbook runsVanilla Ansible, add_hosts
Vanilla Ansible, add_hosts, ANSIBLE_HOST_KEY_CHECKING=noResult: Playbook completes, key is added to known_hosts
Mitogen + Ansible, add_hostsResult: No prompt, playbook fails
Mitogen + Ansible, add_hosts, ANSIBLE_HOST_KEY_CHECKING=noResult: Playbook succeeds, key is not added to known hosts
Mitogen + Ansible, add_hosts with ansible_host_key_checking=falseResult: Playbook fails, no prompt
Characterisation# inv.ini
mitogen ansible_host=192.168.1.112 # issue1066_ping.yml
- hosts: mitogen
gather_facts: false
tasks:
- ping: Playbook runsVanilla Ansible, host from inventory.Result: prompts on an unknown key.
Vanilla Ansible, host from inventory, ANSIBLE_HOST_KEY_CHECKING=noResut: Completes, key is added to known_hosts
Mitogen + Ansible, host form inventoryResult: doesn't prompt, playbook fails
Mitogen + Ansible, host form inventory, ANSIBLE_HOST_KEY_CHECKING=noResult: Playbook completes, key is not added to known hosts
|
Notes to self, these aren't things to address within this issue/PR
|
Some tests were being incorrectly excluded. Including those that use `add_host`. refs mitogen-hq#1066, mitogen-hq#1069
Some tests were being incorrectly excluded. Including those that use `add_host`. refs mitogen-hq#1066, mitogen-hq#1069
Some tests were being incorrectly excluded. Including those that use `add_host`. refs mitogen-hq#1066, mitogen-hq#1069
Some tests were being incorrectly excluded. Including those that use `add_host`. refs mitogen-hq#1066, mitogen-hq#1069
fixes mitogen-hq#1066 Co-authored-by: Philippe Kueck <[email protected]>
Some tests were being incorrectly excluded. Including those that use `add_host`. refs mitogen-hq#1066, mitogen-hq#1069
fixes mitogen-hq#1066 Co-authored-by: Philippe Kueck <[email protected]>
Some tests were being incorrectly excluded. Including those that use `add_host`. refs mitogen-hq#1066, mitogen-hq#1069
Some tests were being incorrectly excluded. Including those that use `add_host`. refs mitogen-hq#1066, mitogen-hq#1069
Some tests were being incorrectly excluded. Including those that use `add_host`. refs mitogen-hq#1066, mitogen-hq#1069
Some tests were being incorrectly excluded. Including those that use `add_host`. refs mitogen-hq#1066, mitogen-hq#1069
When adding a managed node to the current inventory using
add_host
the variableansible_host_key_checking
is not honoured. Let's say we have a vanilla machine ansible-test-100 and this playbook:As ssh doesn't know about the ssh host key yet, the playbook will prompt for a fingerprint confirmation:
To circumvent this, we can add
ansible_host_key_checking: no
to theadd_host
task:Now the playbook runs fine:
Yet this doesn't work with mitogen:
I suggest to add
mitogen_ssh_host_key_checking
which acceptsaccept
,enforce
orignore
to mimic this behaviour:=>
I'll open a draft pr for this, it'd be nice if you could have a look. Or maybe I'm just reinventing the wheel and such a feature already exists somehow 😄
The text was updated successfully, but these errors were encountered: