$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.1.24"
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.1.25"
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
config.vm.define "mysqlserver" do |mysqlserver|
mysqlserver.vm.network "public_network", ip: "192.168.1.26"
end
config.vm.define "ansible" do |ansible|
ansible.vm.network "public_network", ip: "192.168.1.27"
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
end
Bom dia, Segue abaixo validação do arquivos do vagrant, mas aparece apenas duas maquinas. a mysqlserver e ansible não aparece. conferido os "end" aparente não tem a mais e não falta.
d:\ambiente_dev\bionic>vagrant validate Vagrantfile validated successfully.
d:\ambiente_dev\bionic>vagrant validate Vagrant failed to initialize at a very early stage:
There is a syntax error in the following Vagrantfile. The syntax error message is reproduced below for convenience:
d:/ambiente_dev/bionic/Vagrantfile:37: syntax error, unexpected ':', expecting end inline: "apt-get update && ^ d:/ambiente_dev/bionic/Vagrantfile:43: syntax error, unexpected end, expecting end-of-input
d:\ambiente_dev\bionic>vagrant validate Vagrantfile validated successfully.
d:\ambiente_dev\bionic> d:\ambiente_dev\bionic> d:\ambiente_dev\bionic>vagrant status Current machine states:
mysqldb not created (virtualbox) phpweb not created (virtualbox)
This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run vagrant status NAME
.
d:\ambiente_dev\bionic>