-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathVagrantfile
95 lines (81 loc) · 4.04 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "centos/stream9"
config.vm.box_url = "https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-Vagrant-9-latest.x86_64.vagrant-libvirt.box"
#config.vm.box_url = "file:///$VagrantProjectHome/../CentOS-Stream-Vagrant-8-latest.x86_64.vagrant-libvirt.box"
# Forward traffic on the host to the development server on the guest
config.vm.network "forwarded_port", guest: 5000, host: 5000
# Forward traffic on the host to Redis on the guest
config.vm.network "forwarded_port", guest: 6379, host: 6379
# Forward traffic on the host to the SSE server on the guest
config.vm.network "forwarded_port", guest: 8080, host: 8080
if Vagrant.has_plugin?("vagrant-hostmanager")
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
end
# Vagrant can share the source directory using rsync, NFS, or SSHFS (with the vagrant-sshfs
# plugin). By default it rsyncs the current working directory to /vagrant.
#
# If you would prefer to use NFS to share the directory uncomment this and configure NFS
# config.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_version: 4, nfs_udp: false
config.vm.synced_folder "..", "/vagrant"
# config.vm.synced_folder ".", "/vagrant", disabled: true
# config.vm.synced_folder ".", "/srv/pagure",
# ssh_opts_append: "-o IdentitiesOnly=yes",
# type: "sshfs"
# To cache update packages (which is helpful if frequently doing `vagrant destroy && vagrant up`)
# you can create a local directory and share it to the guest's DNF cache. The directory needs to
# exist, so create it before you uncomment the line below.
#Dir.mkdir('.dnf-cache') unless File.exists?('.dnf-cache')
#config.vm.synced_folder ".dnf-cache", "/var/cache/dnf",
# type: "sshfs",
# sshfs_opts_append: "-o nonempty"
# Comment this line if you would like to disable the automatic update during provisioning
# config.vm.provision "shell", inline: "sudo dnf -y --disablerepo '*' --enablerepo=extras swap centos-linux-repos centos-stream-repos"
# !!!!!!! resize disk image !!!!!!!!!
config.vm.provision "shell", inline: "sudo dnf install -y cloud-utils-growpart"
config.vm.provision "shell", inline: "sudo growpart /dev/vda 1"
config.vm.provision "shell", inline: "sudo resize2fs /dev/vda1"
# config.vm.provision "shell", inline: "sudo xfs_growfs /dev/vda1" # this was for CentOS Stream 8
# bootstrap and run with ansible
config.vm.provision "ansible" do |ansible|
# ansible.verbose = "-vvv"
ansible.verbose = true
ansible.playbook = "../playbooks/oc-cluster-setup.yml"
ansible.extra_vars = {"user": "vagrant"}
end
config.vm.provision "ansible" do |ansible|
# ansible.verbose = "-vvv"
ansible.verbose = true
ansible.playbook = "../playbooks/oc-cluster-run.yml"
ansible.raw_arguments = ['--extra-vars', 'user=vagrant', '--extra-vars', '@../secrets/openshift-local-pull-secret.yml']
end
config.vm.provision "ansible" do |ansible|
# ansible.verbose = "-vvv"
ansible.become = true
ansible.become_user = "root"
ansible.verbose = true
ansible.playbook = "../playbooks/oc-cluster-tests-setup.yml"
end
# Create the box
config.vm.define "packit-oc-cluster" do |oc|
oc.vm.host_name = "packit-oc-cluster.example.com"
oc.vm.provider :libvirt do |domain|
# Season to taste
domain.cpus = 6
domain.graphics_type = "spice"
domain.memory = 14336
domain.video_type = "qxl"
domain.machine_virtual_size = 100
# Uncomment the following line if you would like to enable libvirt's unsafe cache
# mode. It is called unsafe for a reason, as it causes the virtual host to ignore all
# fsync() calls from the guest. Only do this if you are comfortable with the possibility of
# your development guest becoming corrupted (in which case you should only need to do a
# vagrant destroy and vagrant up to get a new one).
#
# domain.volume_cache = "unsafe"
end
end
end