diff options
| author | Roberto Bertó <463349+robertoberto@users.noreply.github.com> | 2026-05-19 03:15:55 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-19 03:15:55 -0300 |
| commit | 294d060ac1557ed70cab7a12f97d930f9dc4baf9 (patch) | |
| tree | 25e03a160fb1dc05a27a9118a7a6f573f0ffd123 /examples/vagrant/Vagrantfile | |
| parent | ffd5ba16eb1ada42a582db4ac8bdaf29f66a868f (diff) | |
| parent | 6071528289e4a8b11a772433c33851136d30f133 (diff) | |
| download | pyvyos-294d060ac1557ed70cab7a12f97d930f9dc4baf9.tar.gz pyvyos-294d060ac1557ed70cab7a12f97d930f9dc4baf9.zip | |
Merge pull request #31 from vyos-contrib/release/v0.4.0-cleanupv0.4.0
Release v0.4.0 — cleanup and consolidation
Diffstat (limited to 'examples/vagrant/Vagrantfile')
| -rw-r--r-- | examples/vagrant/Vagrantfile | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/examples/vagrant/Vagrantfile b/examples/vagrant/Vagrantfile new file mode 100644 index 0000000..01dd23e --- /dev/null +++ b/examples/vagrant/Vagrantfile @@ -0,0 +1,47 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Documentation: +# - read VAGRANT.md +# - need vagrant plugin install vagrant-vyos + + +env_vars = File.readlines('.env').each_with_object({}) do |line, hash| + next if line.strip.empty? || line.start_with?('#') + key, value = line.strip.split('=', 2) + hash[key.strip] = value.strip.gsub(/(^['"]|['"]$)/, '') +end + +HTTPS_PORT = env_vars['VYDEVICE_HTTPS_PORT'] +API_KEY = env_vars['VYDEVICE_APIKEY'] +NETMASK = env_vars['VYDEVICE_NETMASK'] +VYOS_VM_IP = env_vars['VYDEVICE_IP'] +VYOS_VM_HOST_IP = env_vars['VYDEVICE_HOST_IP'] + + +$script = <<-SHELL + cfg=/opt/vyatta/sbin/vyatta-cfg-cmd-wrapper + $cfg begin + $cfg set service https api debug + $cfg set service https api keys id apikey key #{API_KEY} + $cfg set service https listen-address $1 + $cfg set service https port #{HTTPS_PORT} + $cfg commit + $cfg end +SHELL + +Vagrant.configure("2") do |config| + # Device VyOS + config.vm.define "pyvyos_device" do |pyvyos| + pyvyos.vm.box = "vyos/current" + pyvyos.vm.hostname = "pyvyos-device" + pyvyos.vm.network "private_network", ip: VYOS_VM_IP , netmask: NETMASK + pyvyos.ssh.host = VYOS_VM_HOST_IP + pyvyos.vm.network "forwarded_port", guest: 443, host: 8433, id: "https", auto_correct: true, protocol: "tcp", host_ip: VYOS_VM_HOST_IP + pyvyos.vm.network "forwarded_port", guest: 22, host: 2022, id: "ssh", auto_correct: true, protocol: "tcp", host_ip: VYOS_VM_HOST_IP + pyvyos.ssh.username = "vyos" + pyvyos.ssh.password = "vyos" + pyvyos.ssh.insert_key = false + pyvyos.vm.provision "shell", inline: $script, args: [VYOS_VM_IP] + end +end
\ No newline at end of file |
