vagrant-systemd 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +22 -0
- data/README.rst +4 -0
- data/Rakefile +3 -0
- data/Vagrantfile +117 -0
- data/lib/vagrant-systemd.rb +63 -0
- data/vagrant-systemd.gemspec +16 -0
- metadata +53 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
# We depend on Vagrant for development, but we don't add it as a
|
7
|
+
# gem dependency because we expect to be installed within the
|
8
|
+
# Vagrant environment itself using `vagrant plugin`.
|
9
|
+
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
|
10
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2012 Benedikt Böhm <bb@xnull.de>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rst
ADDED
data/Rakefile
ADDED
data/Vagrantfile
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure("2") do |config|
|
5
|
+
# All Vagrant configuration is done here. The most common configuration
|
6
|
+
# options are documented and commented below. For a complete reference,
|
7
|
+
# please see the online documentation at vagrantup.com.
|
8
|
+
|
9
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
10
|
+
config.vm.box = "base"
|
11
|
+
config.vm.box_url = "http://zentoo.org/downloads/amd64/base-current.box"
|
12
|
+
config.vm.guest = :systemd
|
13
|
+
|
14
|
+
# The url from where the 'config.vm.box' box will be fetched if it
|
15
|
+
# doesn't already exist on the user's system.
|
16
|
+
# config.vm.box_url = "http://domain.com/path/to/above.box"
|
17
|
+
|
18
|
+
# Create a forwarded port mapping which allows access to a specific port
|
19
|
+
# within the machine from a port on the host machine. In the example below,
|
20
|
+
# accessing "localhost:8080" will access port 80 on the guest machine.
|
21
|
+
# config.vm.network :forwarded_port, guest: 80, host: 8080
|
22
|
+
|
23
|
+
# Create a private network, which allows host-only access to the machine
|
24
|
+
# using a specific IP.
|
25
|
+
# config.vm.network :private_network, ip: "192.168.33.10"
|
26
|
+
|
27
|
+
# Create a public network, which generally matched to bridged network.
|
28
|
+
# Bridged networks make the machine appear as another physical device on
|
29
|
+
# your network.
|
30
|
+
# config.vm.network :public_network
|
31
|
+
|
32
|
+
# If true, then any SSH connections made will enable agent forwarding.
|
33
|
+
# Default value: false
|
34
|
+
# config.ssh.forward_agent = true
|
35
|
+
|
36
|
+
# Share an additional folder to the guest VM. The first argument is
|
37
|
+
# the path on the host to the actual folder. The second argument is
|
38
|
+
# the path on the guest to mount the folder. And the optional third
|
39
|
+
# argument is a set of non-required options.
|
40
|
+
# config.vm.synced_folder "../data", "/vagrant_data"
|
41
|
+
|
42
|
+
# Provider-specific configuration so you can fine-tune various
|
43
|
+
# backing providers for Vagrant. These expose provider-specific options.
|
44
|
+
# Example for VirtualBox:
|
45
|
+
#
|
46
|
+
# config.vm.provider :virtualbox do |vb|
|
47
|
+
# # Don't boot with headless mode
|
48
|
+
# vb.gui = true
|
49
|
+
#
|
50
|
+
# # Use VBoxManage to customize the VM. For example to change memory:
|
51
|
+
# vb.customize ["modifyvm", :id, "--memory", "1024"]
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# View the documentation for the provider you're using for more
|
55
|
+
# information on available options.
|
56
|
+
|
57
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
58
|
+
# are contained in a directory path relative to this Vagrantfile.
|
59
|
+
# You will need to create the manifests directory and a manifest in
|
60
|
+
# the file base.pp in the manifests_path directory.
|
61
|
+
#
|
62
|
+
# An example Puppet manifest to provision the message of the day:
|
63
|
+
#
|
64
|
+
# # group { "puppet":
|
65
|
+
# # ensure => "present",
|
66
|
+
# # }
|
67
|
+
# #
|
68
|
+
# # File { owner => 0, group => 0, mode => 0644 }
|
69
|
+
# #
|
70
|
+
# # file { '/etc/motd':
|
71
|
+
# # content => "Welcome to your Vagrant-built virtual machine!
|
72
|
+
# # Managed by Puppet.\n"
|
73
|
+
# # }
|
74
|
+
#
|
75
|
+
# config.vm.provision :puppet do |puppet|
|
76
|
+
# puppet.manifests_path = "manifests"
|
77
|
+
# puppet.manifest_file = "init.pp"
|
78
|
+
# end
|
79
|
+
|
80
|
+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
|
81
|
+
# path, and data_bags path (all relative to this Vagrantfile), and adding
|
82
|
+
# some recipes and/or roles.
|
83
|
+
#
|
84
|
+
# config.vm.provision :chef_solo do |chef|
|
85
|
+
# chef.cookbooks_path = "../my-recipes/cookbooks"
|
86
|
+
# chef.roles_path = "../my-recipes/roles"
|
87
|
+
# chef.data_bags_path = "../my-recipes/data_bags"
|
88
|
+
# chef.add_recipe "mysql"
|
89
|
+
# chef.add_role "web"
|
90
|
+
#
|
91
|
+
# # You may also specify custom JSON attributes:
|
92
|
+
# chef.json = { :mysql_password => "foo" }
|
93
|
+
# end
|
94
|
+
|
95
|
+
# Enable provisioning with chef server, specifying the chef server URL,
|
96
|
+
# and the path to the validation key (relative to this Vagrantfile).
|
97
|
+
#
|
98
|
+
# The Opscode Platform uses HTTPS. Substitute your organization for
|
99
|
+
# ORGNAME in the URL and validation key.
|
100
|
+
#
|
101
|
+
# If you have your own Chef Server, use the appropriate URL, which may be
|
102
|
+
# HTTP instead of HTTPS depending on your configuration. Also change the
|
103
|
+
# validation key to validation.pem.
|
104
|
+
#
|
105
|
+
# config.vm.provision :chef_client do |chef|
|
106
|
+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
107
|
+
# chef.validation_key_path = "ORGNAME-validator.pem"
|
108
|
+
# end
|
109
|
+
#
|
110
|
+
# If you're using the Opscode platform, your validator client is
|
111
|
+
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
112
|
+
#
|
113
|
+
# If you have your own Chef Server, the default validation client name is
|
114
|
+
# chef-validator, unless you changed the configuration.
|
115
|
+
#
|
116
|
+
# chef.validation_client_name = "ORGNAME-validator"
|
117
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module GuestSystemd
|
5
|
+
class Guest < Vagrant.plugin("2", :guest)
|
6
|
+
def detect?(machine)
|
7
|
+
machine.communicate.test("cat /etc/os-release")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module Cap
|
12
|
+
class ChangeHostName
|
13
|
+
def self.change_host_name(machine, name)
|
14
|
+
machine.communicate.tap do |comm|
|
15
|
+
# Only do this if the hostname is not already set
|
16
|
+
if !comm.test("sudo hostname | grep '#{name}'")
|
17
|
+
comm.sudo("hostnamectl set-hostname #{name}")
|
18
|
+
comm.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} @' /etc/hosts")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class ConfigureNetworks
|
25
|
+
def self.configure_networks(machine, networks)
|
26
|
+
networks.each do |network|
|
27
|
+
entry = TemplateRenderer.render("guests/arch/network_#{network[:type]}",
|
28
|
+
:options => network)
|
29
|
+
|
30
|
+
temp = Tempfile.new("vagrant")
|
31
|
+
temp.binmode
|
32
|
+
temp.write(entry)
|
33
|
+
temp.close
|
34
|
+
|
35
|
+
machine.communicate.upload(temp.path, "/tmp/vagrant_network")
|
36
|
+
machine.communicate.sudo("ln -sf /dev/null /etc/udev/rules.d/80-net-name-slot.rules")
|
37
|
+
machine.communicate.sudo("mv /tmp/vagrant_network /etc/netctl/eth#{network[:interface]}")
|
38
|
+
machine.communicate.sudo("netctl start eth#{network[:interface]}")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class Plugin < Vagrant.plugin("2")
|
45
|
+
name "Systemd based guest"
|
46
|
+
description "Systemd based guest support."
|
47
|
+
|
48
|
+
guest("systemd", "linux") do
|
49
|
+
Guest
|
50
|
+
end
|
51
|
+
|
52
|
+
guest_capability("systemd", "change_host_name") do
|
53
|
+
require_relative "cap/change_host_name"
|
54
|
+
Cap::ChangeHostName
|
55
|
+
end
|
56
|
+
|
57
|
+
guest_capability("systemd", "configure_networks") do
|
58
|
+
require_relative "cap/configure_networks"
|
59
|
+
Cap::ConfigureNetworks
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "vagrant-systemd"
|
5
|
+
s.version = "0.1.0"
|
6
|
+
s.authors = ["Benedikt Böhm"]
|
7
|
+
s.email = ["bb@xnull.de"]
|
8
|
+
s.homepage = "http://github.com/systemd/vagrant-systemd"
|
9
|
+
s.summary = %q{Vagrant plugin to detect and support Systemd based systems}
|
10
|
+
s.description = %q{Vagrant plugin to detect and support Systemd based systems}
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-systemd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Benedikt Böhm
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-06-22 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Vagrant plugin to detect and support Systemd based systems
|
15
|
+
email:
|
16
|
+
- bb@xnull.de
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.rst
|
25
|
+
- Rakefile
|
26
|
+
- Vagrantfile
|
27
|
+
- lib/vagrant-systemd.rb
|
28
|
+
- vagrant-systemd.gemspec
|
29
|
+
homepage: http://github.com/systemd/vagrant-systemd
|
30
|
+
licenses: []
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options: []
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 1.8.25
|
50
|
+
signing_key:
|
51
|
+
specification_version: 3
|
52
|
+
summary: Vagrant plugin to detect and support Systemd based systems
|
53
|
+
test_files: []
|