forked from soroushatarod/Vagrant-Ansible-WordPress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
96 lines (64 loc) · 2.31 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
$OS = 'bento/ubuntu-16.04';
# $OS = 'bento/centos-6.9';
config.vm.box = $OS
$script = <<-SCRIPT
sudo yum install kernel* -y
SCRIPT
$mysql_local_ip_address = "192.168.2.6"
config.vm.network "public_network"
config.ssh.insert_key = false
config.vm.define "apache", primary: true do |v|
v.vm.hostname = "apache.local"
v.vm.network :private_network, ip: "192.168.2.5"
if $OS == 'bento/centos-6.9'
v.vm.provision "shell", run: "always" do |s|
s.inline = $script
end
end
v.vm.synced_folder "www", "/var/www/html"
v.vm.provider "virtualbox" do |apache|
apache.linked_clone = true
apache.memory = "2024"
apache.name = "apache_machine"
end
end
config.vm.define "mysql" do |v|
v.vm.box = $OS
v.vm.synced_folder '.', '/vagrant', disabled: true
v.vm.hostname = "mysql.local"
v.vm.network :private_network, ip: $mysql_local_ip_address
v.vm.provider "virtualbox" do |mysql|
mysql.memory = "4024"
mysql.name = "MySQL"
end
end
config.vm.define "ansible_controller", primary: true do |v|
v.vm.network :private_network, ip: "192.168.2.65"
if $OS == 'bento/centos-6.9'
v.vm.provision "shell", run: "always" do |s|
s.inline = $script
end
end
if $OS == 'bento/ubuntu-16.04'
v.vm.provision "file", source: "provisioning/99force-ipv4.txt", destination: "~/99force-ipv4"
v.vm.provision "shell",
inline: "sudo mv /home/vagrant/99force-ipv4 /etc/apt/apt.conf.d/99force-ipv4"
end
v.vm.provision "ansible_local" do |ansible|
ansible.playbook = "provisioning/provision.yml"
ansible.inventory_path = "inventory"
ansible.config_file = "ansible.cfg"
ansible.limit = "all" # or only "nodes" group, etc.
ansible.extra_vars = {
mysql_root_password: "98_Av&%Ac54",
mysql_server_ip_address: $mysql_local_ip_address,
wordpress_database_name: "wordpress",
mysql_wordpress_username: "wordpress_db",
mysql_wordpress_password: "123456"
}
end
end
end