Apos escrever o codigo descrito na aula 06 - Atividade 4 Instalação do Ansible do curso de Vagrant, o mesmo fica em um loop com o log ssh: Sending SSH keep-alive... e depois da o erro:
" The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong. "
Estou no macOS Big Sur
Codigo do meu vagrant file:
$script = <<-SCRIPT
apt-get update && \
apt-get install -y mysql-server-5.7 && \
mysql -e "create user 'phpuser'@'%' identified by 'pass';"
SCRIPT
$script_ansible = <<-SCRIPT
sudo apt update && \
sudo apt install software-properties-common && \
sudo add-apt-repository --yes --update ppa:ansible/ansible && \
sudo apt install ansible
SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.define "mysqldb" do |mysql|
mysql.vm.network "public_network", bridge: "en0: Wi-Fi (Wireless)", ip: "192.168.0.17"
mysql.vm.provision "shell", inline: "cat /configs/id_rsa.pub >> .ssh/authorized_keys"
mysql.vm.provision "shell", inline: $script
mysql.vm.provision "shell", inline: "cat /configs/mysqld.cnf > /etc/mysql/mysql.conf.d/mysqld.cnf"
mysql.vm.provision "shell", inline: "service mysql restart"
mysql.vm.synced_folder "./configs", "/configs"
mysql.vm.synced_folder ".", "/vagrant", disabled: true
end
config.vm.define "phpweb" do |phpweb|
phpweb.vm.network "forwarded_port", guest: 8888, host: 8888
phpweb.vm.network "public_network", bridge: "en0: Wi-Fi (Wireless)", ip: "192.168.0.16"
phpweb.vm.provision "shell", inline: "apt-get update && apt-get install -y puppet"
phpweb.vm.provision "puppet" do |puppet|
puppet.manifests_path = "./configs/manifests"
puppet.manifest_file = "phpweb.pp"
end
end
config.vm.define "mysqlserver" do |mysqlserver|
mysqlserver.vm.network "public_network", bridge: "en0: Wi-Fi (Wireless)", ip: "192.168.0.19"
end
config.vm.define "ansible" do |ansible|
ansible.vm.network "public_network", bridge: "en0: Wi-Fi (Wireless)", ip: "192.168.0.20"
ansible.vm.provision "shell", inline: $script_ansible
end
end