$script_mysql = <<-SCRIPT
apt-get update && \
apt-get install -y mysql-server-5.7 && \
mysql -e "create user 'phpuser'@'%' identified by 'pass';"
SCRIPT
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.define "mysqldb" do |mysql|
mysql.vm.network "public_network", ip: "192.168.0.17"
mysql.vm.provision "shell",
inline: "cat /configs/id_bionic.pub >> .ssh/authorized_keys"
mysql.vm.provision "shell", inline: $script_mysql
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", ip: "192.168.0.18"
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 "mysqlsever" do |mysqlserver|
mysqlserver.vm.network "public_network", ip: "192.168.1.22"
end
config.vm.define "ansible" do |ansible|
ansible.vm.network "public_network", ip: "192.168.1.26"
ansible.vm.provision "shell",
inline: "apt-get update && \
apt-get install -y software-properties-common && \
apt-add-repository --yes --update ppa:ansible/ansible && \
apt-get install -y ansible"
end
end
ao comandar vagrant up ansible, é apresentada a seguinte mensagem: $ vagrant halt An action 'halt' was attempted on the machine 'ansible', but another process is already executing an action on the machine. Vagrant locks each machine for access by only one process at a time. Please wait until the other Vagrant process finishes modifying this machine, then try again.
If you believe this message is in error, please check the process listing for any "ruby" or "vagrant" processes and kill them. Then try again.