vop-plugins 0.3.1 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/extended/hetzner/commands/add_ssh_key.rb +22 -0
- data/extended/hetzner/commands/disable_linux_install.rb +26 -0
- data/extended/hetzner/commands/enable_linux_install.rb +41 -0
- data/extended/hetzner/commands/hetzner_http.rb +24 -0
- data/extended/hetzner/commands/hetzner_machines.rb +11 -0
- data/extended/hetzner/commands/hetzner_server_list.rb +26 -0
- data/extended/hetzner/commands/linux_install_options.rb +29 -0
- data/extended/hetzner/commands/list_ssh_keys.rb +16 -0
- data/extended/hetzner/entities/hetzner_account.rb +9 -0
- data/extended/hetzner/hetzner.plugin +3 -0
- data/extended/hetzner_vop_0_2_x/commands/list_old_v2_vms.rb +46 -0
- data/extended/hetzner_vop_0_2_x/commands/old_libvirt_machines.rb +16 -0
- data/extended/hetzner_vop_0_2_x/commands/vop_0_2_x_ssh_options.rb +20 -0
- data/extended/hetzner_vop_0_2_x/hetzner_vop_0_2_x.plugin +5 -0
- data/extended/libvirt/commands/delete_vm.rb +32 -0
- data/extended/libvirt/commands/libvirt_config_file.rb +5 -0
- data/extended/libvirt/commands/libvirt_machines.rb +17 -0
- data/extended/libvirt/commands/libvirt_ssh_options.rb +29 -0
- data/extended/libvirt/commands/list_networks.rb +21 -0
- data/extended/libvirt/commands/list_pools.rb +20 -0
- data/extended/libvirt/commands/list_vms.rb +28 -0
- data/extended/libvirt/commands/list_vms_for_scan.rb +12 -0
- data/extended/libvirt/commands/list_vms_with_addresses.rb +20 -0
- data/extended/libvirt/commands/new_vm.rb +110 -0
- data/extended/libvirt/commands/parent.rb +10 -0
- data/extended/libvirt/commands/rename_vm.rb +34 -0
- data/extended/libvirt/commands/start_vm.rb +7 -0
- data/extended/libvirt/commands/stop_vm.rb +8 -0
- data/extended/libvirt/commands/vm_address.rb +7 -0
- data/extended/libvirt/commands/vm_addresses.rb +32 -0
- data/extended/libvirt/commands/vnc_ports.rb +32 -0
- data/extended/libvirt/helpers/helper.rb +3 -0
- data/extended/libvirt/libvirt.plugin +5 -0
- data/extended/libvirt/services/libvirt.rb +19 -0
- data/extended/libvirt_with_proxy/commands/reverse_proxy.rb +13 -0
- data/extended/libvirt_with_proxy/commands/vms_with_domains.rb +18 -0
- data/extended/libvirt_with_proxy/entities/_vms_with_domains.rbx +24 -0
- data/extended/libvirt_with_proxy/libvirt_with_proxy.plugin +1 -0
- data/extended/rails_machines/commands/rails_machines.rb +6 -0
- data/extended/rails_machines/commands/update_status.rb +38 -0
- data/extended/rails_machines/commands/write_found_machines_into_rails_db.rb.not +30 -0
- data/extended/rails_machines/rails_machines.plugin +1 -0
- data/extended/redis_cache/commands/flush_cache.rb +5 -0
- data/extended/redis_cache/commands/invalidate_cache.rb +26 -0
- data/extended/redis_cache/filters/cache_filter.rb +78 -0
- data/extended/redis_cache/helpers/cache_wrapper.rb +35 -0
- data/extended/redis_cache/redis_cache.plugin +8 -0
- data/extended/spares/commands/convert_spare.rb +93 -0
- data/extended/spares/commands/list_spares.rb +9 -0
- data/extended/spares/commands/new_vm_from_spare.rb +24 -0
- data/extended/spares/commands/post_convert_spare.rb +13 -0
- data/extended/spares/commands/prepare_spares.rb +17 -0
- data/extended/spares/commands/wait.rb +29 -0
- data/extended/spares/commands/wtf.rb +9 -0
- data/extended/spares/spares.plugin +1 -0
- data/standard/apt/apt.plugin +0 -0
- data/standard/apt/commands/add_apt_repo.rb +14 -0
- data/standard/git/commands/deploy.rb +19 -0
- data/standard/git/commands/deploy_from_git.rb +34 -0
- data/standard/git/commands/deploy_from_github.rb +12 -0
- data/standard/git/commands/git_clone.rb +7 -0
- data/standard/git/commands/git_clone_web.rb +22 -0
- data/standard/git/git.plugin +0 -0
- data/standard/linux/commands/append_to_file.rb +14 -0
- data/standard/linux/commands/chmod.rb +7 -0
- data/standard/linux/commands/curl.rb +15 -0
- data/standard/linux/commands/current_user.rb +5 -0
- data/standard/linux/commands/distro.rb +2 -1
- data/standard/linux/commands/download_file.rb +6 -6
- data/standard/linux/commands/external_ip.rb +15 -0
- data/standard/linux/commands/file_exists.rb +7 -0
- data/standard/linux/commands/home.rb +7 -0
- data/standard/linux/commands/hostname.rb +5 -0
- data/standard/linux/commands/internal_ip.rb +14 -0
- data/standard/linux/commands/ipaddress.rb +10 -0
- data/standard/linux/commands/list_files.rb +8 -6
- data/standard/linux/commands/list_ip_addresses.rb +22 -0
- data/standard/linux/commands/listen_ports.rb +3 -2
- data/standard/linux/commands/maybe_sudo.rb +8 -0
- data/standard/linux/commands/mkdirs.rb +12 -0
- data/standard/linux/commands/processes.rb +8 -6
- data/standard/linux/commands/processes_like.rb +7 -7
- data/standard/linux/commands/processes_top.rb +23 -0
- data/standard/linux/commands/processes_top_cpu.rb +8 -0
- data/standard/linux/commands/processes_top_mem.rb +8 -0
- data/standard/linux/commands/read_file.rb +7 -2
- data/standard/linux/commands/replace_in_file.rb +22 -0
- data/standard/linux/commands/set_hostname.rb +36 -0
- data/standard/linux/commands/update_hosts_file.rb +27 -0
- data/standard/linux/commands/write_file.rb +8 -21
- data/standard/linux/linux.plugin +1 -2
- data/standard/machines/commands/delete_old_machines.rb +17 -0
- data/standard/machines/commands/localhost.rb +7 -2
- data/standard/machines/commands/localhost_ssh_options.rb +9 -0
- data/standard/machines/commands/new_machine.rb +24 -0
- data/standard/machines/commands/new_vm_from_scratch.rb +25 -0
- data/standard/machines/commands/old_machines.rb +6 -0
- data/standard/machines/commands/select_machine.rb +4 -5
- data/standard/machines/entities/machine.rb +12 -0
- data/standard/machines/machines.plugin +1 -1
- data/standard/redis_machines/commands/installation_status.rb +10 -0
- data/standard/redis_machines/commands/track_installation_status.rb +13 -0
- data/standard/redis_machines/redis_machines.plugin +3 -0
- data/standard/rpm/commands/list_rpm_packages.rb +24 -0
- data/standard/rpm/rpm.plugin +1 -0
- data/standard/scanner/commands/clean_metadata.rb +8 -0
- data/standard/scanner/commands/fresh_ssh_test.rb +6 -0
- data/standard/scanner/commands/inspect_async.rb +6 -0
- data/standard/scanner/commands/inspect_machine.rb +42 -0
- data/standard/scanner/commands/machines_found.rb +35 -0
- data/standard/scanner/commands/metadata.rb +9 -0
- data/standard/scanner/commands/redis_machines.rb +11 -0
- data/standard/scanner/commands/scan.rb +5 -0
- data/standard/scanner/commands/scan_host.rb +7 -0
- data/standard/scanner/commands/scan_machines.rb +11 -0
- data/standard/scanner/commands/trigger_ssh_test.rb +8 -0
- data/standard/scanner/scanner.plugin +5 -0
- data/standard/services/commands/describe_service.rb +7 -0
- data/standard/services/commands/describe_service_installation.rb +13 -0
- data/standard/services/commands/detect_services.rb +34 -0
- data/standard/services/commands/install_service.rb +134 -0
- data/standard/services/commands/list_known_services.rb +14 -0
- data/standard/services/commands/load_plugin_services.rb +17 -0
- data/standard/services/entities/service.rb +3 -0
- data/standard/services/helpers/service.rb +31 -0
- data/standard/services/helpers/service_loader.rb +50 -0
- data/standard/services/helpers/service_syntax.rb +126 -0
- data/standard/services/services.plugin +9 -0
- data/standard/ssh/commands/clean_known_host.rb +11 -0
- data/standard/ssh/commands/clear_ssh_cache.rb +9 -0
- data/standard/ssh/commands/get_ssh_connection.rb +36 -0
- data/standard/ssh/commands/scp_down.rb +9 -0
- data/standard/ssh/commands/scp_up.rb +9 -0
- data/standard/ssh/commands/ssh.rb +20 -0
- data/standard/ssh/commands/ssh_call.rb +98 -0
- data/standard/ssh/commands/ssh_connection.rb +55 -0
- data/standard/ssh/commands/ssh_extended.rb +6 -0
- data/standard/ssh/commands/ssh_options.rb +12 -0
- data/standard/ssh/commands/sudo.rb +12 -0
- data/standard/ssh/commands/test_ssh.rb +43 -0
- data/standard/{linux → ssh}/helpers/regex.rb +0 -0
- data/standard/ssh/ssh.plugin +10 -0
- data/standard/ssh_keys/commands/add_authorized_key.rb +14 -0
- data/standard/ssh_keys/commands/disable_ssh_key_check.rb +11 -0
- data/standard/ssh_keys/commands/generate_keypair.rb +17 -0
- data/standard/ssh_keys/ssh_keys.plugin +0 -0
- data/standard/systemd/commands/disable_systemd_service.rb +8 -0
- data/standard/systemd/commands/enable_systemd_service.rb +8 -0
- data/standard/systemd/commands/list_systemd_services.rb +23 -0
- data/standard/systemd/commands/start_systemd_service.rb +6 -0
- data/standard/systemd/commands/stop_systemd_service.rb +6 -0
- data/standard/systemd/commands/systemd_service_status.rb +6 -0
- data/standard/systemd/commands/write_systemd_config.rb +16 -0
- data/standard/systemd/helpers/param_service.rb +7 -0
- data/standard/systemd/systemd.plugin +0 -0
- data/standard/systemd/templates/systemd_service.erb +11 -0
- data/standard/templates/commands/read_template.rb +8 -0
- data/standard/templates/commands/write_template.rb +37 -0
- data/standard/templates/templates.plugin +3 -0
- data/vop-plugins.gemspec +6 -7
- metadata +156 -55
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -68
- data/standard/debian-iso/commands/fetch_debian_iso.rb +0 -3
- data/standard/debian-iso/commands/fetch_ubuntu_iso.rb +0 -22
- data/standard/debian-iso/commands/list_isos.rb +0 -6
- data/standard/debian-iso/commands/rebuild_debian_iso.rb +0 -40
- data/standard/debian-iso/debian-iso.plugin +0 -2
- data/standard/debian-iso/files/rebuild-debian-iso +0 -74
- data/standard/debian-iso/templates/preseed.cfg +0 -45
- data/standard/libvirt/commands/delete_vm.rb +0 -16
- data/standard/libvirt/commands/list_local_vms.rb +0 -4
- data/standard/libvirt/commands/list_vms.rb +0 -15
- data/standard/libvirt/commands/new_vm.rb +0 -61
- data/standard/libvirt/commands/start_vm.rb +0 -6
- data/standard/libvirt/commands/stop_vm.rb +0 -6
- data/standard/libvirt/libvirt.plugin +0 -2
- data/standard/linux/commands/disk_free.rb +0 -26
- data/standard/linux/commands/disk_used.rb +0 -4
- data/standard/linux/commands/find.rb +0 -15
- data/standard/linux/commands/mkdir.rb +0 -6
- data/standard/linux/todo +0 -2
- data/standard/machines/commands/list_machines_old.rb +0 -7
- data/standard/machines/commands/machine.rb +0 -3
- data/standard/machines/commands/run_command.rb +0 -10
- data/standard/plugin.vop +0 -1
- data/standard/services/loader/service.rb +0 -3
- data/standard/vagrant/commands/vagrant_global_status.rb +0 -32
- data/standard/vagrant/vagrant.plugin +0 -1
- data/standard/working_copies/commands/git_working_copies.rb +0 -11
- data/standard/working_copies/commands/list_project_folders.rb +0 -8
- data/standard/working_copies/commands/working_copy.rb +0 -3
- data/standard/working_copies/working_copies.plugin +0 -1
@@ -1,22 +0,0 @@
|
|
1
|
-
param! 'machine'
|
2
|
-
param! 'dir'
|
3
|
-
|
4
|
-
param! 'version', :default => '16.04'
|
5
|
-
|
6
|
-
run do |machine, dir, version|
|
7
|
-
# sigh
|
8
|
-
urls = {
|
9
|
-
'16.04' => 'http://releases.ubuntu.com/16.04/ubuntu-16.04-server-amd64.iso',
|
10
|
-
'14.04' => 'http://releases.ubuntu.com/14.04/ubuntu-14.04.4-server-amd64.iso'
|
11
|
-
}
|
12
|
-
url = urls[version]
|
13
|
-
unless url
|
14
|
-
url = "http://releases.ubuntu.com/%s/ubuntu-%s-server-amd64.iso" % [version, version]
|
15
|
-
end
|
16
|
-
|
17
|
-
file_name = url.split('/').last
|
18
|
-
machine.download_file(
|
19
|
-
url: url,
|
20
|
-
file: "#{dir}/#{file_name}"
|
21
|
-
)
|
22
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
param! 'machine'
|
2
|
-
param! 'source'
|
3
|
-
param 'just_kidding'
|
4
|
-
|
5
|
-
run do |machine, plugin, source, just_kidding = false|
|
6
|
-
puts "plugin : #{plugin.plugin_dir('files')}"
|
7
|
-
|
8
|
-
# upload the script to rebuild
|
9
|
-
machine.scp(
|
10
|
-
"local_path" => plugin.plugin_dir('files') + "/rebuild-debian-iso",
|
11
|
-
"remote_path" => "/tmp/rebuild-debian-iso"
|
12
|
-
)
|
13
|
-
|
14
|
-
# prepare preseed.cfg
|
15
|
-
machine.ssh("ls /tmp/iso-rebuild || mkdir /tmp/iso-rebuild")
|
16
|
-
# TODO might want to actually evaluate the template
|
17
|
-
machine.scp(
|
18
|
-
"local_path" => plugin.plugin_dir('templates') + "/preseed.cfg",
|
19
|
-
"remote_path" => "/tmp/iso-rebuild/preseed.cfg"
|
20
|
-
)
|
21
|
-
|
22
|
-
# figure out names
|
23
|
-
source_parts = source.split(".")
|
24
|
-
source_parts.pop
|
25
|
-
source_parts << "rebuilt"
|
26
|
-
source_parts << "iso"
|
27
|
-
target = source_parts.join(".")
|
28
|
-
|
29
|
-
# run and grep the filename from the output
|
30
|
-
rebuild_cmd = "/tmp/rebuild-debian-iso #{source} #{target} /tmp/iso-rebuild/preseed.cfg"
|
31
|
-
if just_kidding
|
32
|
-
puts "[noop] would run >>#{rebuild_cmd}<<"
|
33
|
-
else
|
34
|
-
output = machine.ssh("command" => rebuild_cmd, "user" => "root")
|
35
|
-
matched = /Output ISO generated:\s+(.+)/m.match(output)
|
36
|
-
matched.captures.first
|
37
|
-
|
38
|
-
# TODO chown the resulting ISO?
|
39
|
-
end
|
40
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
# from https://github.com/cdown/rebuild-debian-iso
|
4
|
-
|
5
|
-
shopt -s globstar
|
6
|
-
|
7
|
-
input_iso=$1
|
8
|
-
output_iso=$2
|
9
|
-
preseed=$3
|
10
|
-
input_file_dir=$4
|
11
|
-
|
12
|
-
msg() {
|
13
|
-
printf '>>> %s\n' "$@"
|
14
|
-
}
|
15
|
-
|
16
|
-
if ! [[ -r $input_iso && -r $preseed ]]; then
|
17
|
-
printf '%s\n' \
|
18
|
-
"Usage: ${0##*/} <input-iso> <output-iso> <preseed-file> [file-dir]" \
|
19
|
-
"" \
|
20
|
-
"input-iso: the debian iso to modify" \
|
21
|
-
"output-iso: where to store the modified iso" \
|
22
|
-
"preseed-file: the location of a preseed file to inject" \
|
23
|
-
"file-dir: an optional directory to be put at extra/ in the iso"
|
24
|
-
exit 1
|
25
|
-
fi
|
26
|
-
|
27
|
-
iso_dir=$(mktemp -d)
|
28
|
-
initrd_dir=$(mktemp -d)
|
29
|
-
|
30
|
-
msg "Extracting source image"
|
31
|
-
bsdtar -C "$iso_dir" -xf "$input_iso"
|
32
|
-
|
33
|
-
ls $iso_dir/install
|
34
|
-
initrd=$iso_dir/install/initrd.gz
|
35
|
-
|
36
|
-
(
|
37
|
-
cd "$initrd_dir"
|
38
|
-
msg "Extracting initrd"
|
39
|
-
gzip -d < "$initrd" | cpio -i --no-absolute-filenames
|
40
|
-
)
|
41
|
-
|
42
|
-
msg "Injecting preseed"
|
43
|
-
cp "$preseed" "$initrd_dir/preseed.cfg"
|
44
|
-
|
45
|
-
(
|
46
|
-
msg "Rebuilding initrd"
|
47
|
-
cd "$initrd_dir"
|
48
|
-
find . -print0 | cpio -H newc -o -0 | gzip -9 > "$initrd"
|
49
|
-
)
|
50
|
-
|
51
|
-
msg "Setting up automatic booting to preseed"
|
52
|
-
sed -i 's/timeout 0/timeout 5/' "$iso_dir/isolinux/isolinux.cfg"
|
53
|
-
sed -i '/^\tappend/d' "$iso_dir/isolinux/txt.cfg"
|
54
|
-
printf '\tappend vga=788 initrd=/install.amd/initrd.gz auto text\n' >> "$iso_dir/isolinux/txt.cfg"
|
55
|
-
|
56
|
-
if [[ $input_file_dir ]]; then
|
57
|
-
msg "Adding custom files to 'extra' dir on image"
|
58
|
-
cp -a "$input_file_dir" "$iso_dir/extra"
|
59
|
-
fi
|
60
|
-
|
61
|
-
msg "Generating md5sums"
|
62
|
-
( cd "$iso_dir" && find . -type f -exec md5sum {} + > md5sum.txt )
|
63
|
-
|
64
|
-
msg "Generating output ISO image"
|
65
|
-
mkisofs -quiet \
|
66
|
-
-o "$output_iso" \
|
67
|
-
-r -J -no-emul-boot -boot-load-size 4 -boot-info-table \
|
68
|
-
-b isolinux/isolinux.bin -c isolinux/boot.cat \
|
69
|
-
"$iso_dir"
|
70
|
-
|
71
|
-
msg "Removing temporary directories"
|
72
|
-
rm -rf "$iso_dir" "$initrd_dir"
|
73
|
-
|
74
|
-
msg "Output ISO generated: $output_iso"
|
@@ -1,45 +0,0 @@
|
|
1
|
-
## Options to set on the command line
|
2
|
-
d-i keyboard-configuration/layoutcode string de
|
3
|
-
d-i debian-installer/locale string en_US
|
4
|
-
d-i console-setup/ask_detect boolean false
|
5
|
-
d-i console-setup/layoutcode string us
|
6
|
-
d-i netcfg/choose_interface select eth0
|
7
|
-
d-i base-installer/kernel/override-image string linux-server
|
8
|
-
d-i clock-setup/utc-auto boolean true
|
9
|
-
d-i clock-setup/utc boolean true
|
10
|
-
d-i time/zone string US/Pacific
|
11
|
-
d-i clock-setup/ntp boolean true
|
12
|
-
d-i mirror/country string US
|
13
|
-
d-i mirror/http/proxy string
|
14
|
-
d-i mirror/http/mirror select mirror.facebook.net
|
15
|
-
d-i pkgsel/install-language-support boolean false
|
16
|
-
d-i pkgsel/update-policy select none
|
17
|
-
d-i tasksel/first select OpenSSH server
|
18
|
-
d-i netcfg/get_hostname string unassigned-hostname
|
19
|
-
d-i netcfg/get_domain string unassigned-domain
|
20
|
-
d-i partman-auto/method string lvm
|
21
|
-
d-i partman-lvm/device_remove_lvm boolean true
|
22
|
-
d-i partman-md/device_remove_md boolean true
|
23
|
-
d-i partman-lvm/confirm boolean true
|
24
|
-
d-i partman-lvm/confirm_nooverwrite boolean true
|
25
|
-
d-i partman-auto-lvm/guided_size string max
|
26
|
-
d-i partman-auto/choose_recipe select atomic
|
27
|
-
d-i partman/default_filesystem string xfs
|
28
|
-
d-i partman-partitioning/confirm_write_new_label boolean true
|
29
|
-
d-i partman/choose_partition select finish
|
30
|
-
d-i partman/confirm boolean true
|
31
|
-
d-i partman/confirm_nooverwrite boolean true
|
32
|
-
d-i partman-md/confirm boolean true
|
33
|
-
d-i partman-partitioning/confirm_write_new_label boolean true
|
34
|
-
d-i partman/choose_partition select finish
|
35
|
-
d-i partman/confirm boolean true
|
36
|
-
d-i partman/confirm_nooverwrite boolean true
|
37
|
-
d-i partman/unmount_active boolean false
|
38
|
-
d-i passwd/make-user boolean false
|
39
|
-
d-i passwd/root-password password foobar123
|
40
|
-
d-i passwd/root-password-again password foobar123
|
41
|
-
d-i passwd/root-login boolean true
|
42
|
-
d-i user-setup/encrypt-home boolean false
|
43
|
-
d-i grub-installer/only_debian boolean true
|
44
|
-
d-i grub-installer/with_other_os boolean true
|
45
|
-
d-i finish-install/reboot_in_progress note
|
@@ -1,16 +0,0 @@
|
|
1
|
-
param! "machine", :description => "the host machine on which the VM lives"
|
2
|
-
param! "name"
|
3
|
-
|
4
|
-
run do |machine, name|
|
5
|
-
vm_row = machine.list_vms.select { |x| x[:name] == name }.first
|
6
|
-
|
7
|
-
raise "VM not found in list_vms" unless vm_row
|
8
|
-
|
9
|
-
if vm_row[:state] == 'running'
|
10
|
-
machine.stop_vm(name: name)
|
11
|
-
end
|
12
|
-
|
13
|
-
machine.ssh("virsh undefine #{name}")
|
14
|
-
|
15
|
-
# TODO cleanup volumes
|
16
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
param! 'machine'
|
2
|
-
|
3
|
-
#contribute :to => 'machine' do |machine|
|
4
|
-
run do |machine|
|
5
|
-
output = machine.ssh 'virsh list --all'
|
6
|
-
|
7
|
-
data = output.strip.lines[2,output.length-1]
|
8
|
-
data.map do |line|
|
9
|
-
(unused_id, name, *state) = line.strip.split
|
10
|
-
{
|
11
|
-
name: name,
|
12
|
-
state: state.join(" ")
|
13
|
-
}
|
14
|
-
end
|
15
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
param! 'machine'
|
2
|
-
param! 'name', :default_param => true
|
3
|
-
|
4
|
-
param 'memory_size'
|
5
|
-
param 'cpu_count'
|
6
|
-
param 'os_variant'
|
7
|
-
param 'os_type'
|
8
|
-
param 'location'
|
9
|
-
param 'cdrom'
|
10
|
-
param 'extra_args'
|
11
|
-
param 'disk_size'
|
12
|
-
|
13
|
-
param 'vnc_password'
|
14
|
-
param 'vnc_listen'
|
15
|
-
|
16
|
-
run do |params, name, machine|
|
17
|
-
pp params
|
18
|
-
|
19
|
-
memory_size ||= 512
|
20
|
-
cpu_count ||= 1
|
21
|
-
os_variant ||= 'virtio26'
|
22
|
-
os_type ||= 'linux'
|
23
|
-
disk_size ||= 25
|
24
|
-
|
25
|
-
image_dir = "/var/lib/libvirt/images"
|
26
|
-
image_path = "#{image_dir}/#{name}.img"
|
27
|
-
|
28
|
-
command = "virt-install --name '#{name}' --ram #{memory_size} --vcpus=#{cpu_count}" +
|
29
|
-
" --accelerate --os-variant=#{os_variant} --os-type=#{os_type}"
|
30
|
-
|
31
|
-
command += " --disk path=#{image_path},size=#{disk_size},sparse=false,cache=none"
|
32
|
-
|
33
|
-
if params.has_key?('cdrom')
|
34
|
-
command += " --cdrom=#{params['cdrom']}"
|
35
|
-
end
|
36
|
-
|
37
|
-
if params.has_key?('location')
|
38
|
-
command += " --location #{params["location"]}"
|
39
|
-
if params.has_key?('extra_arg')
|
40
|
-
command += " --extra-args=\""
|
41
|
-
params['extra_arg'].each do |extra_arg|
|
42
|
-
command += " #{extra_arg}"
|
43
|
-
end
|
44
|
-
command += "\""
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
if params.has_key?("vnc_password")
|
49
|
-
command += " --graphics vnc,password=#{params["vnc_password"]}"
|
50
|
-
elsif params.has_key?("vnc_listen")
|
51
|
-
command += " --graphics vnc,listen=#{params["vnc_listen"]}"
|
52
|
-
else
|
53
|
-
command += " --nographics"
|
54
|
-
end
|
55
|
-
command += " --noautoconsole"
|
56
|
-
|
57
|
-
puts "command: >>#{command}<<"
|
58
|
-
machine.ssh("command" => command, "user" => "root")
|
59
|
-
|
60
|
-
command
|
61
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
param! :machine
|
2
|
-
param "dir"
|
3
|
-
|
4
|
-
run do |machine, params|
|
5
|
-
command = "df -hl"
|
6
|
-
if params.has_key? "dir"
|
7
|
-
command += " #{params["dir"]}"
|
8
|
-
end
|
9
|
-
|
10
|
-
machine.ssh(command).split("\n")[1..-1].map do |line|
|
11
|
-
(path, size, used, available, percent, mount_point) = line.split
|
12
|
-
{
|
13
|
-
:path => path,
|
14
|
-
:size => size,
|
15
|
-
:used => used,
|
16
|
-
:available => available,
|
17
|
-
:percent => percent,
|
18
|
-
:mount_point => mount_point
|
19
|
-
}
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
__END__
|
24
|
-
|
25
|
-
# Filesystem Size Used Avail Use% Mounted on
|
26
|
-
# /dev/sda8 481G 283G 174G 62% /data
|
@@ -1,15 +0,0 @@
|
|
1
|
-
param! 'machine'
|
2
|
-
param! 'path'
|
3
|
-
param 'type'
|
4
|
-
param 'name'
|
5
|
-
param 'maxdepth'
|
6
|
-
|
7
|
-
run do |machine, path, params|
|
8
|
-
path += "/" unless /\/$/ =~ path
|
9
|
-
find_command = "find #{path}"
|
10
|
-
find_command += " -maxdepth #{params["maxdepth"]}" if params.key? "maxdepth"
|
11
|
-
find_command += " -type #{params["type"]}" if params.key? "type"
|
12
|
-
find_command += " -name #{params["name"]}" if params.key? "name"
|
13
|
-
$logger.debug find_command
|
14
|
-
machine.ssh(find_command).split("\n")
|
15
|
-
end
|
data/standard/linux/todo
DELETED
data/standard/plugin.vop
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1,32 +0,0 @@
|
|
1
|
-
param! 'machine'
|
2
|
-
|
3
|
-
run do |machine|
|
4
|
-
machine.ssh "vagrant global-status --prune"
|
5
|
-
output = machine.ssh "vagrant global-status"
|
6
|
-
|
7
|
-
result = []
|
8
|
-
|
9
|
-
# id name provider state directory
|
10
|
-
# --------------------------------------------------------------------------
|
11
|
-
# 96c4f6f bar virtualbox poweroff /home/philipp/lab/vagrant/bar
|
12
|
-
# 7b81b7a foo libvirt shutoff /home/philipp/lab/vagrant/foo
|
13
|
-
output.lines[2..-1].each do |line|
|
14
|
-
parts = line.strip.split
|
15
|
-
break if parts.size < 5
|
16
|
-
|
17
|
-
(vagrant_id, name, provider, state, directory) = parts
|
18
|
-
|
19
|
-
# the vm name as produced by vagrant-libvirt seems to be the project directory name plus the name defined in the Vagrantfile
|
20
|
-
full_name = directory.split('/')[-1] + '_' + name
|
21
|
-
result << {
|
22
|
-
id: vagrant_id,
|
23
|
-
name: name,
|
24
|
-
full_name: full_name,
|
25
|
-
provider: provider,
|
26
|
-
state: state,
|
27
|
-
directory: directory
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
result
|
32
|
-
end
|