Olá!
Estou tentando rodar o comando na minha VM Ubuntu
ansible-playbook -i ./configs/ansible/hosts ./configs/ansible/playbook.yml
Mas ele sempre está trazendo essa mensagem enorme:
fatal: [192.168.234.137]: UNREACHABLE! =>
{
"changed": false,
"msg": "Failed to connect to the host via ssh:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n@
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
@\r\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r\n
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\r\n
Someone could be eavesdropping on you right now (man-in-the-middle attack)!\r\n
It is also possible that a host key has just been changed.\r\n
The fingerprint for the ECDSA key sent by the remote host is\n
SHA256:teOiFlO59WkaQAqYXHHOTGY2nsJUlUBo9twjot2AyR0.\r\n
Please contact your system administrator.\r\n
Add correct host key in /home/renan/.ssh/known_hosts to get rid of this message.\r\n
Offending ECDSA key in /home/renan/.ssh/known_hosts:2\r\n
remove with:\r\n ssh-keygen -f \"/home/renan/.ssh/known_hosts\" -R \"192.168.234.137\"\r\n
Challenge/response authentication is disabled to avoid man-in-the-middle attacks.\r\nubuntu@192.168.234.137: Permission denied (publickey).", "unreachable": true}
Na VM "mysqlserver" já adicionei a chave pública no arquivo authorized_keys:
vagrant@ubuntu-bionic:~/.ssh$ pwd
/home/vagrant/.ssh
vagrant@ubuntu-bionic:~/.ssh$ cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDK8BZd07ILn4Sc/NOye+JCtmWT+e+iagH7JP0bIKsJHK5BT/vtz4KYC8QZjjpXcCdihC8NHCaptay3g7NBPvx7RQOt/NSkMoXAHLq+vPS7kotWKroCJA3A2t5U+KHmR6MIfp0GkmulZPWYFJG7JmR7aQFdCjWw5kIeGdN4SvPYB3AKlQuWgi5FODMdhsdjtm1O1+ksV2k3lYHG1192M5MfDFS6hEZuk0lksqnTLndsnyFfwxvk52+2S9SaFLZS0dE+vw1JEMLiuoH0J2vT0v7+0r9D+5WTofEEED+V7IbO6Ws+Ah3g6pCN/JNIo5hIClyMZ13U7pamDa1xAEx6NoO3 vagrant
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC31GDt5rMB68oU1PZt7pT7Fns2Y/z8alRDI9wVIYbVY8pdnzLsEMbYML19QNTwrtbaNuSLBM5qhCTkJgXV0W2yOmlCLjo4FAtypGi341fsmU8LkhVUn81Lx3XrzcRSii1RDKw7F1RAjMRK2dbQv6IjOqtkdEvVuRvLMald0BMSqtT5uAEl2IGuUwESHrl/Wb300emQijZZGpOsIIyn9mDNBlgT3I7vFFDg7yG7W5e+mI6VumEaBzopiKikm2I0K/PW/caOyshbLYkbHUgXH6kxvb97VXrxMFkn2W9NsFXsPY8/8K2JVCCY0Zzv0eubgSlNYXZKFL6+QiowDdHus9DJ renan@ubuntu
Meu arquivo hosts está assim:
[mysqlserver]
192.168.234.137
[mysqlserver:vars]
ansible_user=ubuntu
ansible_ssh_key_file=/home/renan/ambiente_dev/bionic64/ubuntu_key
ansible_python_interpreter=/usr/bin/python3
ansible_ssh_common_args='-o StrictHostKeyChecking=no'
O arquivo "playbook.yml" está igual ao da aula.
Este é o Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.define "mysqlserver" do |mysqlserver|
mysqlserver.vm.network "public_network", ip: "192.168.234.137"
mysqlserver.vm.provision "shell", inline: "cat /vagrant/configs/ubuntu_key.pub >> .ssh/authorized_keys"
end
end
O que mais devo fazer para conseguir rodar o comando para rodar o ansible?