-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathVagrantfile.common
104 lines (92 loc) · 3.16 KB
/
Vagrantfile.common
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
97
98
99
100
101
102
103
104
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Common settings used by all nodes of all configurations
# This file should be included by the Vagrantfile of each cluster configuration
#
$StorageScale_version = "5.2.2.0"
Vagrant.configure('2') do |config|
# Sync folders and files from host to guests
config.vm.synced_folder "../setup", "/vagrant", type: "rsync"
# Configure permissions for shell scripts
config.vm.provision "shell",
name: "Configure permissions for shell scripts",
inline: "
chmod 755 /vagrant/*/*.sh
"
# Configure /etc/hosts
# ... for AWS
if $StorageScaleVagrant_provider == 'AWS'
then
config.vm.provision "shell",
name: "Configure /etc/hosts for AWS",
inline: "
echo \"`hostname -I` m1.example.com m1\" >> /etc/hosts
# Get primary IP
IPA=$(hostname -I | awk '{print $1}')
# Extract IP Range
IPRANGE=${IPA%.*}
# Try .200 as VIP
NEWIP=${IPRANGE}.200
if [ \"$NEWIP\" == \"$IPA\" ];
then
# In case 200 is taken, use different one
NEWIP=${IPRANGE}.201
fi
echo \"$NEWIP cesip.example.com cesip\" >> /etc/hosts
"
end
# ... for VirtualBox
# Configure /etc/hosts
if $StorageScaleVagrant_provider == 'VirtualBox' || $StorageScaleVagrant_provider == 'libvirt'
then
config.vm.provision "shell",
name: "Configure /etc/hosts for VirtualBox",
inline: "
cp /vagrant/files/linux/etc__hosts /etc/hosts
"
end
# Generate ssh keys for user root
# Note: The Storage Scale installation toolkit requires root ssh
config.vm.provision "shell",
name: "Generate ssh keys for user root",
inline: "
ssh-keygen -q -N '' -m PEM -f /root/.ssh/id_rsa
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
"
# Configure ssh host keys
config.vm.provision "shell",
name: "Configure ssh host keys",
inline: "
/usr/bin/sudo /usr/bin/bash -c '/usr/bin/ssh-keyscan m1 >> /root/.ssh/known_hosts'
"
# Get fingerprint for management IP address
if $StorageScaleVagrant_provider == 'VirtualBox' || $StorageScaleVagrant_provider == 'libvirt'
then
config.vm.provision "shell",
name: "Get fingerprint for management IP address",
inline: "
/usr/bin/sudo /usr/bin/bash -c '/usr/bin/ssh-keyscan -t ecdsa m1m.example.com >> /root/.ssh/known_hosts'
"
end
# Add Storage Scale executables to $PATH
config.vm.provision "shell",
name: "Add /usr/lpp/mmfs/bin to $PATH",
inline: "
cp /vagrant/files/linux/etc__profile.d__spectrumscale.sh /etc/profile.d/spectrumscale.sh
"
# Add Storage Scale executables to sudo secure_path
config.vm.provision "shell",
name: "Add /usr/lpp/mmfs/bin to sudo secure_path",
inline: "
cp /vagrant/files/linux/etc__sudoers.d__spectrumscale /etc/sudoers.d/spectrumscale
"
# Expand root file system beyond default 10GB
config.vm.provision "shell",
name: "Expand root file system",
inline: "
/usr/bin/sudo /usr/bin/bash -c \"echo ', +' | sfdisk -N 1 --force --no-reread /dev/vda\"
/usr/bin/sudo partprobe /dev/vda
/usr/bin/sudo xfs_growfs /dev/vda1
"
end