2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ansibleで 'FAILED: Host key for server does not match!'

Posted at

ansible.cnf で host_key_checking = False にする

hostsでssh先に複数同じホストがある場合

# cat hosts 
[local]                    
127.0.0.1

[webservers]
docker  ansible_ssh_port=22 ansible_ssh_host=192.168.1.5
ssh1    ansible_ssh_port=2222 ansible_ssh_host=192.168.1.5
ssh2    ansible_ssh_port=2223 ansible_ssh_host=192.168.1.5
# ansible-playbook -i hosts site.yml --check
PLAY [all nodes] **************************************************************

GATHERING FACTS *************************************************************** 
fatal: [ssh1] => {'msg': 'FAILED: Host key for server 192.168.1.5 does not match!', 'failed': True}
fatal: [ssh2] => {'msg': 'FAILED: Host key for server 192.168.1.5 does not match!', 'failed': True}
ok: [docker]

ansible.cfg 変更

#diff -u /etc/ansible/ansible.cfg_ /etc/ansible/ansible.cfg
--- /etc/ansible/ansible.cfg_   2014-08-07 08:36:30.000000000 +0900
+++ /etc/ansible/ansible.cfg    2014-09-19 17:34:11.678637384 +0900
@@ -36,7 +36,7 @@
 #roles_path    = /etc/ansible/roles
 
 # uncomment this to disable SSH key host checking
-#host_key_checking = False
+host_key_checking = False
 
 # change this for alternative sudo implementations
 sudo_exe = sudo
/etc/ansible/zabbix #

OK

# ansible-playbook -i hosts site.yml --check

PLAY [all nodes] **************************************************************

GATHERING FACTS ***************************************************************
ok: [ssh1]
ok: [docker]
ok: [ssh2]
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?