Хотите настроить сайт локально, установите Ubuntu 18.04 (Vargant 2.1, VM 5.2, Ansible)
Бродячий файл содержит ...
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.box_check_update = false
config.vm.define "web3" do |web3|
end
config.vm.network "private_network", ip: "192.168.56.56"
# share/www
config.vm.synced_folder "share/www", "/var/www", id: "vagrant-www",
:create => true,
:owner => "vagrant",
:group => "vagrant",
:mount_options => ["dmode=775,fmode=775"]
config.vm.provider "virtualbox" do |vb|
vb.name = "web3"
vb.memory = 4096
vb.cpus = 2
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "90"]
vb.customize ["modifyvm", :id, "--uart1", "0x3F8", "4" ]
vb.customize ["modifyvm", :id, "--uartmode1", "file", "console.log" ]
end
config.vbguest.auto_update = false
config.vm.provision "shell", inline: <<-SHELL
echo "ubuntu:ubuntu" | sudo chpasswd
SHELL
config.vm.provision "ansible" do |ansible|
ansible.playbook = "provision/playbook.yml"
ansible.inventory_path = "provision/vagrant_ansible_inventory"
ansible.sudo = true
ansible.host_key_checking = false
if ENV.has_key?('verbose')
ansible.verbose = ENV['verbose']
end
ansible.extra_vars = {
ansible_ssh_user: 'ubuntu',
ansible_connection: 'ssh',
ansible_ssh_args: '-o ForwardAgent=yes'
}
ansible.raw_arguments = [
"--private-key=.vagrant/machines/web3/virtualbox/private_key"
]
if ENV.has_key?('tags')
ansible.tags = ENV['tags'].split(',')
end
end
end
Запустите vagrant up (provision) и получите эту ошибку в консоли.
TASK [install python2] *********************************************************
fatal: [web3]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Warning: Permanently added '192.168.56.56' (ECDSA) to the list of known hosts.\r\nalex@192.168.56.56: Permission denied (publickey).\r\n", "unreachable": true}
to retry, use: --limit @/home/alex/Projects/vm/provision/playbook.retry
PLAY RECAP *********************************************************************
web3 : ok=0 changed=0 unreachable=1 failed=0
Что мне следует написать в файле vargant, чтобы избежать этой ошибки?
Необходимо использовать SSH, можно ли подключиться без него?
Та же ошибка на другом компьютере (Ubuntu 16.04)
полный стек
<192.168.56.52> ESTABLISH SSH CONNECTION FOR USER: ubuntu
<192.168.56.52> SSH: EXEC ssh -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/home/gil/vagrant/vm/.vagrant/machines/onno/virtualbox/private_key -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o 'IdentityFile="/home/gil/vagrant/vm/.vagrant/machines/onno/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=30 -o ControlPath=/home/gil/.ansible/cp/7ecc584fc8 -tt 192.168.56.52 'sudo -H -S -n -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-ujsujrqhjylrxjabjmxzblqijoesfdib; sudo apt-get -y install python-simplejson'"'"''
<192.168.56.52> (255, '', "Warning: Permanently added '192.168.56.52' (ECDSA) to the list of known hosts.\r\nPermission denied (publickey).\r\n")