vagrant-libvirt 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/README.md +40 -10
- data/example_box/Vagrantfile +15 -3
- data/lib/vagrant-libvirt/action.rb +8 -0
- data/lib/vagrant-libvirt/action/connect_libvirt.rb +4 -4
- data/lib/vagrant-libvirt/action/create_network_interfaces.rb +1 -1
- data/lib/vagrant-libvirt/action/create_networks.rb +5 -8
- data/lib/vagrant-libvirt/action/handle_box_image.rb +8 -1
- data/lib/vagrant-libvirt/action/prepare_nfs_settings.rb +66 -0
- data/lib/vagrant-libvirt/action/prune_nfs_exports.rb +26 -0
- data/lib/vagrant-libvirt/action/read_ssh_info.rb +11 -7
- data/lib/vagrant-libvirt/action/share_folders.rb +76 -0
- data/lib/vagrant-libvirt/action/sync_folders.rb +1 -0
- data/lib/vagrant-libvirt/errors.rb +1 -1
- data/lib/vagrant-libvirt/provider.rb +1 -0
- data/lib/vagrant-libvirt/templates/private_network.xml.erb +3 -3
- data/lib/vagrant-libvirt/version.rb +1 -1
- data/tools/prepare_redhat_for_box.sh +9 -2
- metadata +5 -2
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 0.0.6 (Jul 24, 2013)
|
2
|
+
|
3
|
+
* Synced folder via NFS support.
|
4
|
+
* Routed private network support.
|
5
|
+
* Configurable ssh parameters in Vagrantfile via `config.ssh.*`.
|
6
|
+
* Fixed uploading base box image to storage pool bug (buffer was too big).
|
7
|
+
|
1
8
|
# 0.0.5 (May 10, 2013)
|
2
9
|
|
3
10
|
* Private networks support.
|
data/README.md
CHANGED
@@ -4,12 +4,12 @@ This is a [Vagrant](http://www.vagrantup.com) 1.1+ plugin that adds an
|
|
4
4
|
[Libvirt](http://libvirt.org) provider to Vagrant, allowing Vagrant to
|
5
5
|
control and provision machines via Libvirt toolkit.
|
6
6
|
|
7
|
-
**Note:** Actual version (0.0.
|
7
|
+
**Note:** Actual version (0.0.6) is still a development one. Feedback is
|
8
8
|
welcome and can help a lot :-)
|
9
9
|
|
10
|
-
## Features (Version 0.0.
|
10
|
+
## Features (Version 0.0.6)
|
11
11
|
|
12
|
-
* Controll local
|
12
|
+
* Controll local Libvirt hypervisors.
|
13
13
|
* Vagrant `up`, `destroy`, `suspend`, `resume`, `halt`, `ssh` and `provision` commands.
|
14
14
|
* Upload box image (qcow2 format) to Libvirt storage pool.
|
15
15
|
* Create volume as COW diff image for domains.
|
@@ -18,7 +18,7 @@ welcome and can help a lot :-)
|
|
18
18
|
* SSH into domains.
|
19
19
|
* Setup hostname and network interfaces.
|
20
20
|
* Provision domains with any built-in Vagrant provisioner.
|
21
|
-
*
|
21
|
+
* Synced folder support via `rsync` or `nfs`.
|
22
22
|
|
23
23
|
## Future work
|
24
24
|
|
@@ -66,6 +66,11 @@ centos64 box and setup with 10.20.30.40 IP address.
|
|
66
66
|
|
67
67
|
```ruby
|
68
68
|
Vagrant.configure("2") do |config|
|
69
|
+
|
70
|
+
# If you are still using old centos box, you have to setup root username for
|
71
|
+
# ssh access. Read more in section 'SSH Access To VM'.
|
72
|
+
config.ssh.username = "root"
|
73
|
+
|
69
74
|
config.vm.define :test_vm do |test_vm|
|
70
75
|
test_vm.vm.box = "centos64"
|
71
76
|
test_vm.vm.network :private_network, :ip => '10.20.30.40'
|
@@ -110,6 +115,7 @@ Vagrant.configure("2") do |config|
|
|
110
115
|
dbserver.vm.provider :libvirt do |domain|
|
111
116
|
domain.memory = 2048
|
112
117
|
domain.cpus = 2
|
118
|
+
domain.nested = true
|
113
119
|
end
|
114
120
|
end
|
115
121
|
|
@@ -153,7 +159,7 @@ An examples of network interface definitions:
|
|
153
159
|
|
154
160
|
```ruby
|
155
161
|
config.vm.define :test_vm1 do |test_vm1|
|
156
|
-
test_vm1.vm.network :private_network, :ip =>
|
162
|
+
test_vm1.vm.network :private_network, :ip => "10.20.30.40",
|
157
163
|
end
|
158
164
|
```
|
159
165
|
|
@@ -178,14 +184,18 @@ starts with 'libvirt__' string. Here is a list of those options:
|
|
178
184
|
network 'default' is used.
|
179
185
|
* `:libvirt__netmask` - Used only together with `:ip` option. Default is
|
180
186
|
'255.255.255.0'.
|
181
|
-
* `:libvirt__nat_interface` - Name of interface, where should network be
|
182
|
-
NATed. Used only when creating new network. By default, all physical
|
183
|
-
interfaces are used.
|
184
|
-
* `:libvirt__isolated` - If network should be isolated - without NAT to outside.
|
185
|
-
Used only when creating new network. Default is set to false.
|
186
187
|
* `:libvirt__dhcp_enabled` - If DHCP will offer addresses, or not. Used only
|
187
188
|
when creating new network. Default is true.
|
188
189
|
* `:libvirt__adapter` - Number specifiyng sequence number of interface.
|
190
|
+
* `:libvirt__forward_mode` - Specify one of `none`, `nat` or `route` options.
|
191
|
+
This option is used only when creating new network. Mode `none` will create
|
192
|
+
isolated network without NATing or routing outside. You will want to use
|
193
|
+
NATed forwarding typically to reach networks outside of hypervisor. Routed
|
194
|
+
forwarding is typically useful to reach other networks within hypervisor.
|
195
|
+
By default, option `nat` is used.
|
196
|
+
* `:libvirt__forward_device` - Name of interface/device, where network should
|
197
|
+
be forwarded (NATed or routed). Used only when creating new network. By
|
198
|
+
default, all physical interfaces are used.
|
189
199
|
|
190
200
|
## Obtaining Domain IP Address
|
191
201
|
|
@@ -197,6 +207,24 @@ makes lease information public in `/var/lib/libvirt/dnsmasq` directory, or in
|
|
197
207
|
information like which MAC address has which IP address resides and it's parsed
|
198
208
|
by vagrant-libvirt plugin.
|
199
209
|
|
210
|
+
## SSH Access To VM
|
211
|
+
|
212
|
+
There are some configuration options for ssh access to VM via `config.ssh.*` in
|
213
|
+
Vagrantfile. Untill provider version 0.0.5, root user was hardcoded and used to
|
214
|
+
access VMs ssh. Now, vagrant user is used by default, but it's configurable via
|
215
|
+
`config.ssh.username` option in Vagrantfile now.
|
216
|
+
|
217
|
+
If you are still using CentOS 6.4 box from example in this README, please set
|
218
|
+
ssh username back to root, because user vagrant is not usable (I forgot to add
|
219
|
+
necessary ssh key to his authorized_keys).
|
220
|
+
|
221
|
+
Configurable ssh parameters in Vagrantfile after provider version 0.0.5 are:
|
222
|
+
|
223
|
+
* `config.ssh.username` - Default is username vagrant.
|
224
|
+
* `config.ssh.guest_port` - Default port is set to 22.
|
225
|
+
* `config.ssh.forward_agent` - Default is false.
|
226
|
+
* `config.ssh.forward_x11` - Default is false.
|
227
|
+
|
200
228
|
## Synced Folders
|
201
229
|
|
202
230
|
There is minimal support for synced folders. Upon `vagrant up`, the Libvirt
|
@@ -206,6 +234,8 @@ to the remote machine over SSH.
|
|
206
234
|
This is good enough for all built-in Vagrant provisioners (shell,
|
207
235
|
chef, and puppet) to work!
|
208
236
|
|
237
|
+
If used options `:nfs => true`, folder will exported by nfs.
|
238
|
+
|
209
239
|
## Box Format
|
210
240
|
|
211
241
|
You can view an example box in the [example_box/directory](https://github.com/pradels/vagrant-libvirt/tree/master/example_box). That directory also contains instructions on how to build a box.
|
data/example_box/Vagrantfile
CHANGED
@@ -7,13 +7,25 @@ Vagrant.configure("2") do |config|
|
|
7
7
|
#
|
8
8
|
#config.vm.define :test_vm do |test_vm|
|
9
9
|
# Box name
|
10
|
+
#
|
10
11
|
#test_vm.vm.box = "centos64"
|
11
12
|
|
13
|
+
# Domain Specific Options
|
14
|
+
#
|
15
|
+
# See README for more info.
|
16
|
+
#
|
17
|
+
#test_vm.vm.provider :libvirt do |domain|
|
18
|
+
# domain.memory = 2048
|
19
|
+
# domain.cpus = 2
|
20
|
+
#end
|
21
|
+
|
12
22
|
# Interfaces for VM
|
13
23
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
24
|
+
# Networking features in the form of `config.vm.network` support private
|
25
|
+
# networks concept. No public network or port forwarding are supported in
|
26
|
+
# current version of provider. See README for more info.
|
27
|
+
#
|
28
|
+
#test_vm.vm.network :private_network, :ip => '10.20.30.40'
|
17
29
|
#end
|
18
30
|
|
19
31
|
# Options for libvirt vagrant provider.
|
@@ -24,6 +24,10 @@ module VagrantPlugins
|
|
24
24
|
b2.use TimedProvision
|
25
25
|
b2.use CreateNetworks
|
26
26
|
b2.use CreateNetworkInterfaces
|
27
|
+
|
28
|
+
b2.use NFS
|
29
|
+
b2.use PrepareNFSSettings
|
30
|
+
b2.use ShareFolders
|
27
31
|
b2.use SetHostname
|
28
32
|
b2.use StartDomain
|
29
33
|
b2.use WaitTillUp
|
@@ -100,6 +104,7 @@ module VagrantPlugins
|
|
100
104
|
end
|
101
105
|
|
102
106
|
b2.use ConnectLibvirt
|
107
|
+
b2.use PruneNFSExports
|
103
108
|
b2.use DestroyDomain
|
104
109
|
b2.use DestroyNetworks
|
105
110
|
end
|
@@ -274,6 +279,9 @@ module VagrantPlugins
|
|
274
279
|
autoload :WaitTillUp, action_root.join("wait_till_up")
|
275
280
|
autoload :SyncFolders, action_root.join("sync_folders")
|
276
281
|
autoload :SSHRun, "vagrant/action/builtin/ssh_run"
|
282
|
+
autoload :PrepareNFSSettings, action_root.join("prepare_nfs_settings")
|
283
|
+
autoload :PruneNFSExports, action_root.join("prune_nfs_exports")
|
284
|
+
autoload :ShareFolders, action_root.join("share_folders")
|
277
285
|
end
|
278
286
|
end
|
279
287
|
end
|
@@ -18,7 +18,7 @@ module VagrantPlugins
|
|
18
18
|
env[:libvirt_compute] = Libvirt.libvirt_connection
|
19
19
|
return @app.call(env)
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
# Get config options for libvirt provider.
|
23
23
|
config = env[:machine].provider_config
|
24
24
|
|
@@ -38,7 +38,7 @@ module VagrantPlugins
|
|
38
38
|
else
|
39
39
|
uri << '://'
|
40
40
|
uri << config.host if config.host
|
41
|
-
end
|
41
|
+
end
|
42
42
|
uri << '/system?no_verify=1'
|
43
43
|
|
44
44
|
conn_attr = {}
|
@@ -46,7 +46,7 @@ module VagrantPlugins
|
|
46
46
|
conn_attr[:libvirt_uri] = uri
|
47
47
|
conn_attr[:libvirt_username] = config.username if config.username
|
48
48
|
conn_attr[:libvirt_password] = config.password if config.password
|
49
|
-
|
49
|
+
|
50
50
|
# Setup command for retrieving IP address for newly created machine
|
51
51
|
# with some MAC address. Get it from dnsmasq leases table - either
|
52
52
|
# /var/lib/libvirt/dnsmasq/*.leases files, or
|
@@ -54,7 +54,7 @@ module VagrantPlugins
|
|
54
54
|
ip_command = "LEASES='/var/lib/libvirt/dnsmasq/*.leases'; "
|
55
55
|
ip_command << "[ -f /var/lib/misc/dnsmasq.leases ] && "
|
56
56
|
ip_command << "LEASES='/var/lib/misc/dnsmasq.leases'; "
|
57
|
-
ip_command << "
|
57
|
+
ip_command << "grep $mac $LEASES | awk '{ print $3 }'"
|
58
58
|
conn_attr[:libvirt_ip_command] = ip_command
|
59
59
|
|
60
60
|
@logger.info("Connecting to Libvirt (#{uri}) ...")
|
@@ -45,6 +45,8 @@ module VagrantPlugins
|
|
45
45
|
@options = scoped_hash_override(options, :libvirt)
|
46
46
|
@options = {
|
47
47
|
:netmask => '255.255.255.0',
|
48
|
+
:dhcp_enabled => true,
|
49
|
+
:forward_mode => 'nat',
|
48
50
|
}.merge(@options)
|
49
51
|
|
50
52
|
# Prepare a hash describing network for this specific interface.
|
@@ -201,14 +203,9 @@ module VagrantPlugins
|
|
201
203
|
@network_address = @interface_network[:ip_address]
|
202
204
|
@network_netmask = @interface_network[:netmask]
|
203
205
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
@network_forward_mode = 'nat'
|
208
|
-
|
209
|
-
if @options[:nat_interface]
|
210
|
-
@network_nat_interface = @options[:nat_interface]
|
211
|
-
end
|
206
|
+
@network_forward_mode = @options[:forward_mode]
|
207
|
+
if @options[:forward_device]
|
208
|
+
@network_forward_device = @options[:forward_device]
|
212
209
|
end
|
213
210
|
|
214
211
|
if @options[:dhcp_enabled]
|
@@ -96,7 +96,14 @@ module VagrantPlugins
|
|
96
96
|
volume = pool.lookup_volume_by_name(volume_name)
|
97
97
|
stream = env[:libvirt_compute].client.stream
|
98
98
|
volume.upload(stream, offset=0, length=image_size)
|
99
|
-
|
99
|
+
|
100
|
+
# Exception Libvirt::RetrieveError can be raised if buffer is
|
101
|
+
# longer than length accepted by API send function.
|
102
|
+
#
|
103
|
+
# TODO: How to find out if buffer is too large and what is the
|
104
|
+
# length that send function will accept?
|
105
|
+
|
106
|
+
buf_size = 1024*250 # 250K
|
100
107
|
progress = 0
|
101
108
|
open(image_file, 'rb') do |io|
|
102
109
|
while (buff = io.read(buf_size)) do
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
module VagrantPlugins
|
3
|
+
module Libvirt
|
4
|
+
module Action
|
5
|
+
class PrepareNFSSettings
|
6
|
+
def initialize(app,env)
|
7
|
+
@app = app
|
8
|
+
@logger = Log4r::Logger.new("vagrant::action::vm::nfs")
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
@app.call(env)
|
13
|
+
|
14
|
+
using_nfs = false
|
15
|
+
env[:machine].config.vm.synced_folders.each do |id, opts|
|
16
|
+
if opts[:nfs]
|
17
|
+
using_nfs = true
|
18
|
+
break
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if using_nfs
|
23
|
+
@logger.info("Using NFS, preparing NFS settings by reading host IP and machine IP")
|
24
|
+
env[:nfs_host_ip] = read_host_ip(env[:machine],env)
|
25
|
+
env[:nfs_machine_ip] = env[:machine].ssh_info[:host]
|
26
|
+
|
27
|
+
raise Vagrant::Errors::NFSNoHostonlyNetwork if !env[:nfs_machine_ip]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns the IP address of the first host only network adapter
|
32
|
+
#
|
33
|
+
# @param [Machine] machine
|
34
|
+
# @return [String]
|
35
|
+
def read_host_ip(machine,env)
|
36
|
+
nets = env[:libvirt_compute].list_networks
|
37
|
+
if nets.size == 1
|
38
|
+
net = nets.first
|
39
|
+
else
|
40
|
+
domain = env[:libvirt_compute].servers.get(machine.id.to_s)
|
41
|
+
xml=Nokogiri::XML(domain.to_xml)
|
42
|
+
networkname = xml.xpath('/domain/devices/interface/source').first.attributes['network'].value.to_s
|
43
|
+
puts "network name = #{networkname}"
|
44
|
+
net = env[:libvirt_compute].list_networks.find {|netw| netw[:name] == networkname}
|
45
|
+
end
|
46
|
+
# FIXME better implement by libvirt xml parsing
|
47
|
+
`ip addr show | grep -A 2 #{net[:bridge_name]} | grep -i 'inet ' | tr -s ' ' | cut -d' ' -f3 | cut -d'/' -f 1`.chomp
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns the IP address of the guest by looking at the first
|
51
|
+
# enabled host only network.
|
52
|
+
#
|
53
|
+
# @return [String]
|
54
|
+
def read_machine_ip(machine)
|
55
|
+
machine.config.vm.networks.each do |type, options|
|
56
|
+
if type == :private_network && options[:ip].is_a?(String)
|
57
|
+
return options[:ip]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
nil
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
module VagrantPlugins
|
3
|
+
module Libvirt
|
4
|
+
module Action
|
5
|
+
class PruneNFSExports
|
6
|
+
|
7
|
+
def initialize(app, env)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
if env[:host]
|
13
|
+
uuid = env[:machine].id
|
14
|
+
# get all uuids
|
15
|
+
uuids = env[:libvirt_compute].servers.all.map(&:id)
|
16
|
+
# not exiisted in array will removed from nfs
|
17
|
+
uuids.delete(uuid)
|
18
|
+
env[:host].nfs_prune(uuids)
|
19
|
+
end
|
20
|
+
|
21
|
+
@app.call(env)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -40,15 +40,19 @@ module VagrantPlugins
|
|
40
40
|
}
|
41
41
|
raise Errors::NoIpAddressError if not ip_address
|
42
42
|
|
43
|
-
|
44
|
-
# TODO: Some info should be configurable in Vagrantfile
|
45
|
-
return {
|
43
|
+
ssh_info = {
|
46
44
|
:host => ip_address,
|
47
|
-
:port =>
|
48
|
-
:username =>
|
49
|
-
:forward_agent =>
|
50
|
-
:forward_x11 =>
|
45
|
+
:port => machine.config.ssh.guest_port,
|
46
|
+
:username => machine.config.ssh.username,
|
47
|
+
:forward_agent => machine.config.ssh.forward_agent,
|
48
|
+
:forward_x11 => machine.config.ssh.forward_x11,
|
51
49
|
}
|
50
|
+
|
51
|
+
if not ssh_info[:username]
|
52
|
+
ssh_info[:username] = machine.config.ssh.default.username
|
53
|
+
end
|
54
|
+
|
55
|
+
ssh_info
|
52
56
|
end
|
53
57
|
end
|
54
58
|
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require "pathname"
|
2
|
+
|
3
|
+
require "log4r"
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module Libvirt
|
7
|
+
module Action
|
8
|
+
class ShareFolders
|
9
|
+
def initialize(app, env)
|
10
|
+
@logger = Log4r::Logger.new("vagrant::action::vm::share_folders")
|
11
|
+
@app = app
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
@env = env
|
16
|
+
|
17
|
+
prepare_folders
|
18
|
+
create_metadata
|
19
|
+
|
20
|
+
@app.call(env)
|
21
|
+
end
|
22
|
+
|
23
|
+
# This method returns an actual list of shared
|
24
|
+
# folders to create and their proper path.
|
25
|
+
def shared_folders
|
26
|
+
{}.tap do |result|
|
27
|
+
@env[:machine].config.vm.synced_folders.each do |id, data|
|
28
|
+
# Ignore NFS shared folders
|
29
|
+
next if !data[:nfs]
|
30
|
+
|
31
|
+
# convert to NFS share
|
32
|
+
#data[:nfs] = true
|
33
|
+
|
34
|
+
# This to prevent overwriting the actual shared folders data
|
35
|
+
result[id] = data.dup
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Prepares the shared folders by verifying they exist and creating them
|
41
|
+
# if they don't.
|
42
|
+
def prepare_folders
|
43
|
+
shared_folders.each do |id, options|
|
44
|
+
hostpath = Pathname.new(options[:hostpath]).expand_path(@env[:root_path])
|
45
|
+
|
46
|
+
if !hostpath.directory? && options[:create]
|
47
|
+
# Host path doesn't exist, so let's create it.
|
48
|
+
@logger.debug("Host path doesn't exist, creating: #{hostpath}")
|
49
|
+
|
50
|
+
begin
|
51
|
+
hostpath.mkpath
|
52
|
+
rescue Errno::EACCES
|
53
|
+
raise Vagrant::Errors::SharedFolderCreateFailed,
|
54
|
+
:path => hostpath.to_s
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def create_metadata
|
61
|
+
@env[:ui].info I18n.t("vagrant.actions.vm.share_folders.creating")
|
62
|
+
|
63
|
+
folders = []
|
64
|
+
shared_folders.each do |id, data|
|
65
|
+
folders << {
|
66
|
+
:name => id,
|
67
|
+
:hostpath => File.expand_path(data[:hostpath], @env[:root_path]),
|
68
|
+
:transient => data[:transient]
|
69
|
+
}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
<name><%= @network_name %></name>
|
3
3
|
<bridge name="<%= @network_bridge_name %>" />
|
4
4
|
|
5
|
-
<% if @network_forward_mode !=
|
6
|
-
<% if @
|
7
|
-
<forward mode="<%= @network_forward_mode %>" dev="<%= @
|
5
|
+
<% if @network_forward_mode != 'none' %>
|
6
|
+
<% if @network_forward_device %>
|
7
|
+
<forward mode="<%= @network_forward_mode %>" dev="<%= @network_forward_device %>" />
|
8
8
|
<% else %>
|
9
9
|
<forward mode="<%= @network_forward_mode %>" />
|
10
10
|
<% end %>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
# For more info about creating custom box refer to
|
11
11
|
# https://github.com/pradels/vagrant-libvirt/tree/master/example_box
|
12
12
|
|
13
|
-
# We need a hostname.
|
13
|
+
# We need to set a hostname.
|
14
14
|
if [ $# -ne 1 ]; then
|
15
15
|
echo "Usage: $0 <hostname>"
|
16
16
|
echo "Hostname should be in format vagrant-[os-name], e.g. vagrant-redhat63."
|
@@ -75,7 +75,7 @@ sed -i 's/Defaults\s*requiretty/Defaults !requiretty/' /etc/sudoers
|
|
75
75
|
|
76
76
|
|
77
77
|
# SSH setup
|
78
|
-
# Add Vagrant ssh key for root
|
78
|
+
# Add Vagrant ssh key for root and vagrant accouts.
|
79
79
|
sed -i 's/.*UseDNS.*/UseDNS no/' /etc/ssh/sshd_config
|
80
80
|
|
81
81
|
[ -d ~root/.ssh ] || mkdir ~root/.ssh
|
@@ -85,6 +85,13 @@ ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7
|
|
85
85
|
EOF
|
86
86
|
chmod 600 ~root/.ssh/authorized_keys
|
87
87
|
|
88
|
+
[ -d ~vagrant/.ssh ] || mkdir ~vagrant/.ssh
|
89
|
+
chmod 700 ~vagrant/.ssh
|
90
|
+
cat > ~vagrant/.ssh/authorized_keys << EOF
|
91
|
+
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
|
92
|
+
EOF
|
93
|
+
chmod 600 ~vagrant/.ssh/authorized_keys
|
94
|
+
|
88
95
|
|
89
96
|
# Disable firewall and switch SELinux to permissive mode.
|
90
97
|
chkconfig iptables off
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-libvirt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
@@ -94,10 +94,13 @@ files:
|
|
94
94
|
- lib/vagrant-libvirt/action/message_not_created.rb
|
95
95
|
- lib/vagrant-libvirt/action/message_not_running.rb
|
96
96
|
- lib/vagrant-libvirt/action/message_not_suspended.rb
|
97
|
+
- lib/vagrant-libvirt/action/prepare_nfs_settings.rb
|
98
|
+
- lib/vagrant-libvirt/action/prune_nfs_exports.rb
|
97
99
|
- lib/vagrant-libvirt/action/read_ssh_info.rb
|
98
100
|
- lib/vagrant-libvirt/action/read_state.rb
|
99
101
|
- lib/vagrant-libvirt/action/resume_domain.rb
|
100
102
|
- lib/vagrant-libvirt/action/set_name_of_domain.rb
|
103
|
+
- lib/vagrant-libvirt/action/share_folders.rb
|
101
104
|
- lib/vagrant-libvirt/action/start_domain.rb
|
102
105
|
- lib/vagrant-libvirt/action/suspend_domain.rb
|
103
106
|
- lib/vagrant-libvirt/action/sync_folders.rb
|