1
- # Vagrant 1.7+ automatically inserts a different
2
- # insecure keypair for each new VM created. The easiest way
3
- # to use the same keypair for all the machines is to disable
4
- # this feature and rely on the legacy insecure key.
5
- # config.ssh.insert_key = false
6
- #
7
- # Note:
8
- # As of Vagrant 1.7.3, it is no longer necessary to disable
9
- # the keypair creation when using the auto-generated inventory.
10
- $geonode_source_path= /home/luca /Development /geonode -project
11
- $script1 = <<-'SCRIPT'
12
- sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
13
- sudo chmod +x /usr/local/bin/docker-compose
14
- sudo apt-get install \
15
- apt-transport-https \
16
- ca-certificates \
17
- curl \
18
- gnupg \
19
- lsb-release
20
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
21
- echo \
22
- "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
23
- $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
24
- sudo apt-get update
25
- sudo apt-get -y install docker-ce docker-ce-cli containerd.io
26
- sudo adduser vagrant docker
27
- sudo docker swarm init
28
- SCRIPT
29
-
30
- $script2 = <<-'SCRIPT'
31
- if [ -d "$HOME/antani" ]; then
32
- cd $HOME/antani
33
- [ -f $HOME/antani/.env ] && docker-compose down
34
- cd ..
35
- sudo rm -rf $HOME/antani
36
- fi
37
- SCRIPT
38
-
39
- $script3 = <<-'SCRIPT'
40
- sudo apt-get update
41
- sudo apt-get -y install python3-pip python3-virtualenv virtualenvwrapper
42
- SCRIPT
43
-
44
- Vagrant . configure ( 2 ) do |config |
45
- boxes = {
46
- 'ubuntu01' => 'ubuntu/focal64'
47
- }
48
- machine_id = 0
49
- boxes . each do | key , value |
50
- config . vm . box = "#{ value } "
51
- machine_id = machine_id + 1
52
-
53
-
54
- config . vm . define "#{ key } " do |node |
55
- node . vm . hostname = "#{ key } "
56
- #node.vm.network "private_network", ip: "192.168.68.#{20+machine_id}"
57
- # Only execute once the Ansible provisioner,
58
- # when all the machines are up and ready.
59
-
60
- config . vm . provision "shell" , inline : $script1, privileged : false
61
- config . vm . provision "shell" , inline : $script2, run : 'always' , privileged : false
62
- #edit source path suiting your needs
63
- config . vm . provision "file" , source : $geonode_source_path, destination : "$HOME/geonode-project" , run : 'always'
64
- config . vm . provision "shell" , inline : $script3, run : 'always' , privileged : false
65
- config . vm . provision :shell , path : "antani-vagrant.sh" , run : 'always' , privileged : false
66
-
67
-
68
- end
69
- end
70
- end
0 commit comments