1
+ Vagrant . configure ( "2" ) do |config |
2
+
3
+ config . vm . define "acs" do |acs |
4
+ acs . vm . box = "generic/alma8"
5
+ acs . vm . hostname = "acs"
6
+ acs . vm . network "private_network" , ip : "192.168.15.56"
7
+
8
+ # Make sure all sensitive info is only readable by user.
9
+ acs . vm . synced_folder "." , "/vagrant" , mount_options : [ "dmode=700,fmode=600" ]
10
+
11
+ # Do the initial setup of the ACS with a script.
12
+ acs . vm . provision "shell" do |shell |
13
+ shell . inline = <<-SHELL
14
+ set -euxo pipefail
15
+
16
+ # netstat -rn shows something like:
17
+ # Kernel IP routing table
18
+ # Destination Gateway Genmask Flags MSS Window irtt Iface
19
+ # 0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0 eth0
20
+ # 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
21
+ # 192.168.15.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
22
+ # We retrieve the Gateway from this output:
23
+ host_ip=$(netstat -rn | grep '^0.0.0.0' | awk '{print $2}')
24
+ echo "http_proxy=http://$host_ip:9000" >> /etc/environment
25
+ echo "https_proxy=http://$host_ip:9000" >> /etc/environment
26
+
27
+ export http_proxy=http://$host_ip:9000
28
+ export https_proxy=http://$host_ip:9000
29
+
30
+ yum install -y epel-release
31
+ yum install -y ansible
32
+ SHELL
33
+ end
34
+ end
35
+
36
+ config . vm . define "node1" do |node1 |
37
+ node1 . vm . box = "centos/7"
38
+ node1 . vm . hostname = "node1"
39
+ node1 . vm . network "private_network" , ip : "192.168.15.57"
40
+ end
41
+
42
+ end
0 commit comments