forked from pulp/devel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile.example
More file actions
128 lines (106 loc) · 5.66 KB
/
Copy pathVagrantfile.example
File metadata and controls
128 lines (106 loc) · 5.66 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
# Synced folders are declared here,
# host => guest
VAGRANT_SYNCED_FOLDERS = {
# This code
'.' => '/vagrant',
# For access to sibling repos (e.g. pulp_rpm, pulp_docker, ...)
'..' => '/home/vagrant/devel',
# You can speed up package installs in subsequent "vagrant up" operations by making the dnf
# cache a synced folder. This is essentially what the vagrant-cachier plugin would do for us
# if it supported dnf, and unfortunately that project is in need of maintainers so this might
# be the best we can do for now. Note that you'll have to manually create the '.dnf-cache'
# directory in the same directory as this Vagrantfile for this to work.
#'.dnf-cache' => '/var/cache/dnf'
}
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# It is possible to use URLs to nightly images produced by the Fedora project here. You can find
# the nightly composes here: https://kojipkgs.fedoraproject.org/compose/
# Sometimes, a nightly compose is incomplete and does not contain a Vagrant image, so you may need
# to browse that repository a bit to find the latest successful Vagrant image. The name of the image
# should end with "vagrant-libvirt.box". To configure for CentOS, use the box "centos/7", and change
# the value for 'ansible_python_interpreter' in 'group_vars/all' to '/usr/bin/python2'
config.vm.box = "fedora/28-cloud-base"
# Comment out if you don't want Vagrant to add and remove entries from /etc/hosts for each VM.
# requires the vagrant-hostmanager plugin to be installed
if Vagrant.has_plugin?("vagrant-hostmanager")
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/pulp-from-source.yml"
# ansible.verbose = "vvv"
# ansible.start_at_task = "ansible task name here"
# ansible.extra_vars = { use_rabbitmq: false }
ansible.extra_vars = { development: true }
end
# Create the "pulp3_dev" box
config.vm.define :pulp3_dev do |pulp3_dev|
pulp3_dev.vm.host_name = "pulp3"
VAGRANT_SYNCED_FOLDERS.each do |host_path, guest_path|
# Use SSHFS instead of NFS. Requires the vagrant-sshfs plugin to be installed.
# Use SSHFS to share directories. The ``-o nonempty`` option is passed to allow
# mounts on non-empty directories.
pulp3_dev.vm.synced_folder host_path, guest_path, type: "sshfs", sshfs_opts_append: "-o nonempty"
# Comment this out if you use a different filesystem (like sshfs)
# pulp3_dev.vm.synced_folder host_path, guest_path, type: "nfs", nfs_version: 4, nfs_udp: false
end
pulp3_dev.vm.provider :libvirt do |domain, override|
domain.cpus = 4
# In some cases, the guest gets stuck at "Waiting for domain to get an IP address..." if
# the default cpu_mode, 'host-model', is used. Using 'host-passthrough' cpu_mode prevents
# VM migration between hosts with different CPUs. However, development environments are
# expected to live on a single host for the duration of their existence. Due to this known
# issue and our use case, the default cpu_mode is overridden.
domain.cpu_mode = "host-passthrough"
domain.graphics_type = "spice"
domain.memory = 2048
domain.video_type = "qxl"
# Uncomment this to expand the disk to the given size, in GB (default is usually 40)
# You'll also need to uncomment the provisioning step below that resizes the root partition
# do not set this to a size smaller than the base box, or you will be very sad
# domain.machine_virtual_size = 80
# 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"
# Uncomment this to resize the root partition and filesystem to fill the base box disk
# This script is only guaranteed to work with the default official fedora image, and is
# only needed it you changed machine_virtual_size above.
# For other boxen, use at your own risk
# override.vm.provision "shell", path: "scripts/vagrant-resize-disk.sh"
end
pulp3_dev.vm.provider :docker do |d, override|
require 'rbconfig'
os = RbConfig::CONFIG['host_os'].downcase
uid = Process.euid
gid = Process.egid
override.vm.box = nil
# Based on fedora official image, with vagrant's needs met:
# https://github.com/rohanpm/docker-fedora-vagrant
# plugins/providers/docker/action/login.rb
d.build_dir = 'docker/'
d.build_args = ["--build-arg=USER_EUID=#{uid}"]
unless os.include? "darwin" then
d.build_args.push("--build-arg=USER_EGID=#{gid}")
end
# use ssh for the sake of ansible
d.has_ssh = true
# Necessary for systemd to work
d.privileged = true
# Expose any ports other containers may want to connect to
# http, https, rabbitmq, postgres, redis
d.expose = [80, 443, 5672, 5432, 6379]
VAGRANT_SYNCED_FOLDERS.each do |host_path, guest_path|
# Let the synced folders use docker's native mechanism
# (bind mounts) instead of NFS
override.vm.synced_folder host_path, guest_path, type: nil
end
end
end
end