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
@@ -0,0 +1,27 @@
|
|
1
|
+
param! :machine
|
2
|
+
param! "ip"
|
3
|
+
param! "content"
|
4
|
+
|
5
|
+
run do |machine, ip, content|
|
6
|
+
hosts = machine.read_file("/etc/hosts").split("\n")
|
7
|
+
ip.gsub!(".", "\.")
|
8
|
+
regex = /#{ip}/
|
9
|
+
|
10
|
+
unless hosts.grep(regex)
|
11
|
+
raise "IP #{ip} not found in hosts file:\n#{hosts}"
|
12
|
+
end
|
13
|
+
|
14
|
+
new_hosts = hosts.map do |host|
|
15
|
+
if host =~ regex
|
16
|
+
"#{ip} #{content}"
|
17
|
+
else
|
18
|
+
host
|
19
|
+
end
|
20
|
+
end.join("\n")
|
21
|
+
|
22
|
+
machine.write_file(
|
23
|
+
file_name: "/etc/hosts",
|
24
|
+
content: new_hosts,
|
25
|
+
sudo: true
|
26
|
+
)
|
27
|
+
end
|
@@ -1,26 +1,13 @@
|
|
1
|
-
require "tempfile"
|
2
|
-
|
3
1
|
param! :machine
|
4
|
-
param! "
|
2
|
+
param! "file_name"
|
5
3
|
param! "content"
|
4
|
+
param "sudo", default: false
|
6
5
|
|
7
|
-
run do |machine,
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
tmp.write content
|
13
|
-
bytes_written = tmp.size
|
14
|
-
tmp.flush()
|
15
|
-
tmp.close()
|
16
|
-
|
17
|
-
$logger.debug "scp from #{tmp.path} to #{file}"
|
18
|
-
machine.scp(
|
19
|
-
local_path: tmp.path,
|
20
|
-
remote_path: file
|
21
|
-
)
|
22
|
-
ensure
|
23
|
-
tmp.delete
|
6
|
+
run do |machine, file_name, content, sudo|
|
7
|
+
write_cmd = if sudo
|
8
|
+
"| sudo tee #{file_name}"
|
9
|
+
else
|
10
|
+
"> #{file_name}"
|
24
11
|
end
|
25
|
-
|
12
|
+
machine.ssh "echo '#{content}' #{write_cmd}"
|
26
13
|
end
|
data/standard/linux/linux.plugin
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
depends :machines
|
1
|
+
depends_on [ :ssh, :machines ]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
description "removes all machines that have not been seen for more than 7 days"
|
2
|
+
|
3
|
+
param "just_kidding", default: false
|
4
|
+
|
5
|
+
run do |just_kidding|
|
6
|
+
morituri = @op.old_machines || []
|
7
|
+
morituri.each do |machine|
|
8
|
+
one_machine = Machine.where(name: machine.name).first
|
9
|
+
unless one_machine.nil?
|
10
|
+
if just_kidding
|
11
|
+
$logger.warn "not really deleting #{one_machine.name}"
|
12
|
+
else
|
13
|
+
one_machine.delete
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
param! "name"
|
2
|
+
|
3
|
+
param :machine, description: "a virtualization host on which the VM should be created"
|
4
|
+
|
5
|
+
run do |params, name, machine|
|
6
|
+
unless machine
|
7
|
+
machine = @op.machines["cabildo.traederphi"]
|
8
|
+
end
|
9
|
+
|
10
|
+
@op.track_installation_status(
|
11
|
+
host_name: machine.name,
|
12
|
+
vm_name: name,
|
13
|
+
status: "preparing"
|
14
|
+
)
|
15
|
+
|
16
|
+
params.delete("machine")
|
17
|
+
machine.new_vm_from_spare(params)
|
18
|
+
|
19
|
+
@op.track_installation_status(
|
20
|
+
host_name: machine.name,
|
21
|
+
vm_name: name,
|
22
|
+
status: "prepared"
|
23
|
+
)
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
param! "name"
|
2
|
+
|
3
|
+
param! :machine, description: "a virtualization host on which the VM should be created"
|
4
|
+
|
5
|
+
param "memory", description: "in MB", default: 512
|
6
|
+
param "cpu_count", default: 1
|
7
|
+
param "disk_size", description: "in GB", default: 25
|
8
|
+
|
9
|
+
run do |machine, name, params|
|
10
|
+
@op.track_installation_status(
|
11
|
+
host_name: machine.name,
|
12
|
+
vm_name: name,
|
13
|
+
status: "installing"
|
14
|
+
)
|
15
|
+
|
16
|
+
@op.new_vm_from_latest_ubuntu(params)
|
17
|
+
|
18
|
+
@op.track_installation_status(
|
19
|
+
host_name: machine.name,
|
20
|
+
vm_name: name,
|
21
|
+
status: "installed"
|
22
|
+
)
|
23
|
+
|
24
|
+
"#{name}.#{machine.name}"
|
25
|
+
end
|
@@ -1,8 +1,7 @@
|
|
1
|
-
param!
|
2
|
-
lookup: lambda { |params| @op.list_machines.map { |x| x[:name] }}
|
1
|
+
param! :machine, use_context: false
|
3
2
|
|
4
|
-
run do |
|
5
|
-
context[
|
6
|
-
context[
|
3
|
+
run do |machine, context|
|
4
|
+
context["machine"] = machine.name
|
5
|
+
context["prompt"] = "#{machine.name} >> "
|
7
6
|
true
|
8
7
|
end
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
# TODO depends_on :isoremix
|
@@ -0,0 +1,13 @@
|
|
1
|
+
param! "host_name"
|
2
|
+
param! "vm_name"
|
3
|
+
param! "status"
|
4
|
+
|
5
|
+
#block_param!
|
6
|
+
|
7
|
+
run do |host_name, vm_name, status, plugin|
|
8
|
+
redis = plugin.state[:redis]
|
9
|
+
|
10
|
+
full_name = "#{vm_name}.#{host_name}"
|
11
|
+
cache_key = "vop.installation_status.#{full_name}"
|
12
|
+
redis.set(cache_key, status)
|
13
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
description "returns a list of installed RPM packages"
|
2
|
+
|
3
|
+
param! :machine
|
4
|
+
|
5
|
+
read_only
|
6
|
+
|
7
|
+
show columns: [ :full_string, :name, :version ]
|
8
|
+
|
9
|
+
# TODO this used to be in 0.2:
|
10
|
+
# available_if do |params|
|
11
|
+
# @op.with_machine(params["machine"]) do |machine|
|
12
|
+
# machine.linux_distribution.split("_").first == "centos" or
|
13
|
+
# machine.linux_distribution.split("_").first == "sles"
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
|
17
|
+
contribute to: "list_packages" do |machine|
|
18
|
+
#ivtv-firmware-20080701-20.2.noarch
|
19
|
+
#e2fsprogs-1.41.12-3.el6.x86_64
|
20
|
+
ssh_regex(machine, "rpm -qa",
|
21
|
+
/^((.+?)-(\d+.+))$/,
|
22
|
+
[:full_string, :name, :version]
|
23
|
+
)
|
24
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
depends_on :ssh
|
@@ -0,0 +1,42 @@
|
|
1
|
+
param! :machine
|
2
|
+
|
3
|
+
run do |machine|
|
4
|
+
result = {
|
5
|
+
"ssh_status" => "unknown",
|
6
|
+
"internal_ip" => "unknown"
|
7
|
+
}
|
8
|
+
|
9
|
+
machine_type = machine.metadata["type"]
|
10
|
+
if machine_type == "vm"
|
11
|
+
# make sure the internal IP we've got is up to date
|
12
|
+
machine.parent.vm_addresses!(name: machine.name.split(".").first)
|
13
|
+
end
|
14
|
+
machine.ssh_options!
|
15
|
+
|
16
|
+
begin
|
17
|
+
result["ssh_status"] = machine.test_ssh!
|
18
|
+
rescue => e
|
19
|
+
$logger.info "error testing ssh connect to #{machine.name} : #{e.message}"
|
20
|
+
if e.message =~ /no SSH options/
|
21
|
+
ssh_error = "no_ssh_options"
|
22
|
+
else
|
23
|
+
ssh_error = e.message
|
24
|
+
end
|
25
|
+
result["ssh_error"] = ssh_error
|
26
|
+
end
|
27
|
+
|
28
|
+
if result["ssh_status"]
|
29
|
+
begin
|
30
|
+
result["internal_ip"] = machine.internal_ip
|
31
|
+
rescue => e
|
32
|
+
$logger.error "problem reading internal IP from #{machine.name} : #{e.message}"
|
33
|
+
end
|
34
|
+
|
35
|
+
result["distro"] = machine.distro
|
36
|
+
result["processes"] = machine.processes!
|
37
|
+
result["processes_top_mem"] = machine.processes_top_mem
|
38
|
+
|
39
|
+
result["services"] = machine.detect_services!
|
40
|
+
end
|
41
|
+
result
|
42
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "time"
|
2
|
+
require "redis"
|
3
|
+
|
4
|
+
param! "machines", multi: true
|
5
|
+
|
6
|
+
show display_type: :hash
|
7
|
+
|
8
|
+
run do |machines, plugin|
|
9
|
+
scanned = @op.collect_contributions(
|
10
|
+
"command_name" => "machines_found",
|
11
|
+
"raw_params" => { "machines" => machines }
|
12
|
+
)
|
13
|
+
|
14
|
+
redis = plugin.state[:redis]
|
15
|
+
|
16
|
+
MACHINE_LIST = "vop.machines"
|
17
|
+
#redis.ltrim(MACHINE_LIST, 1, 0) # empty
|
18
|
+
known = redis.lrange(MACHINE_LIST, 0, -1)
|
19
|
+
|
20
|
+
begin
|
21
|
+
machines.each do |machine_row|
|
22
|
+
machine_name = machine_row["name"]
|
23
|
+
cache_key = "vop.machine.#{machine_name}"
|
24
|
+
redis.set(cache_key, machine_row.to_json)
|
25
|
+
|
26
|
+
unless known.include? machine_name
|
27
|
+
redis.rpush(MACHINE_LIST, machine_name)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
ensure
|
31
|
+
@op.redis_machines!
|
32
|
+
end
|
33
|
+
|
34
|
+
{}
|
35
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
description "collects a list of scanned machines and adds them to the database if necessary"
|
2
|
+
|
3
|
+
contribute to: "scan" do
|
4
|
+
scanned = @op.collect_contributions("scan_machines")
|
5
|
+
$logger.debug "scanned contributions: #{scanned.size}"
|
6
|
+
stats = @op.machines_found(scanned)
|
7
|
+
|
8
|
+
@op.machines.each &:inspect_async
|
9
|
+
|
10
|
+
stats
|
11
|
+
end
|