-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
71 lines (63 loc) · 2.97 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.define "ubuntu-vm2" do |vm2|
vm2.vm.box_version = "1.0.0"
vm2.ssh.insert_key = false
vm2.vm.hostname = "ubuntu-vm2"
vm2.vm.box = "trusty64"
vm2.vm.network 'private_network', ip: '192.168.33.20'
vm2.vm.provider "virtualbox" do |vb|
vb.name = "ubuntu-vm2"
vb.gui = false
vb.memory = "1024"
end
vm2.vm.synced_folder ".", "/vagrant", disabled: false #vagrant fileın bulunduğu yer, vagrant file olarak linux da maple.
# vm2.vm.synced_folder "./phpScript", "/vagrant/phpScript", disabled: false
vm2.vm.provision "shell", inline: "cat /vagrant/ansible/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys"
vm2.vm.provision "shell", inline: "cp /vagrant/ansible/id_rsa /tmp/id_rsa", privileged: false
vm2.vm.provision "shell", inline: "chmod 600 /tmp/id_rsa", privileged: false
vm2.vm.provision "shell", inline: "mkdir -p /etc/ansible", privileged: true
vm2.vm.provision "shell", inline: "cp /vagrant/nginx/inventories/ansible.cfg /etc/ansible/ansible.cfg", privileged: true, run: "always"
# vm2.vm.provision "shell", inline: <<-SHELL
# echo "Hello from the Ubuntu VM2"
# SHELL
end
config.vm.define "ubuntu-vm" do |vm1|
vm1.vm.box_version = "1.0.0"
vm1.ssh.insert_key = false
vm1.vm.hostname = "ubuntu-vm"
vm1.vm.box = "trusty64"
vm1.vm.network 'private_network', ip: '192.168.33.10'
vm1.vm.provider "virtualbox" do |vb|
vb.name = "ubuntu-vm"
vb.gui = false
vb.memory = "1024"
end
vm1.vm.synced_folder ".", "/vagrant", disabled: false
vm1.vm.provision "shell", inline: "cat /vagrant/ansible/id_rsa.pub >> /home/vagrant/.ssh/authorized_keys"
vm1.vm.provision "shell", inline: "cp /vagrant/ansible/id_rsa /tmp/id_rsa", privileged: false
vm1.vm.provision "shell", inline: "chmod 600 /tmp/id_rsa", privileged: false
vm1.vm.provision "shell", inline: "mkdir -p /etc/ansible", privileged: true
vm1.vm.provision "shell", inline: "cp /vagrant/nginx/inventories/ansible.cfg /etc/ansible/ansible.cfg", privileged: true, run: "always"
# vm1.vm.provision "shell", inline: <<-SHELL
# echo "Hello from the Ubuntu VM"
# SHELL
vm1.vm.provision "ansible_local" do |ansible|
ansible.limit = "all"
ansible.playbook = "/vagrant/nginx/playbooks/ping-playbook.yml"
ansible.inventory_path = "/vagrant/nginx/inventories/inventory"
ansible.install_mode = "pip"
ansible.version = "2.9.10"
end
end
end