SHARE
TWEET

Untitled

a guest Feb 16th, 2020 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3.  
  4. $docker_install = <<-SCRIPT
  5.  
  6. apt-get update 2>> ~vagrant/docker-install-logs.txt
  7. apt-get install -y curl 2>> ~vagrant/docker-install-logs.txt
  8. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 2>> ~vagrant/docker-install-logs.txt
  9. sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" 2>> ~vagrant/docker-install-logs.txt
  10. apt-get update 2>> ~vagrant/docker-install-logs.txt
  11. sudo apt install docker-ce -y 2>> ~vagrant/docker-install-logs.txt
  12. usermod -aG docker vagrant 2>> ~vagrant/docker-install-logs.txt
  13.  
  14. SCRIPT
  15.  
  16. $getRancher2 = <<-SCRIPT
  17.  
  18. docker run -d --restart=unless-stopped \
  19.     -p 80:80 -p 443:443 \
  20.     rancher/rancher:latest 2>> ~vagrant/rancher_node.txt
  21. SCRIPT
  22.  
  23. $getRancherAgent2 = <<-SCRIPT
  24.  
  25. SCRIPT
  26.  
  27. def provision_shell_node(instance)
  28.     instance.vm.provision "docker_install", type: "shell", inline: $docker_install
  29.     instance.vm.provision "getRancher2", type: "shell", inline: $getRancher2
  30. end
  31.  
  32. def provision_shell_agent(instance)
  33.     instance.vm.provision "docker_install", type: "shell", inline: $docker_install
  34.     instance.vm.provision "getRancherAgent2", type: "shell", inline: $getRancherAgent2
  35. end
  36.  
  37. Vagrant.configure("2") do |config|
  38.  
  39.     config.vm.box = "ubuntu/bionic64"
  40.     config.vm.provider "virtualbox" do |vb|
  41.         vb.memory = 1024
  42.         vb.cpus = 1
  43.         # linked_clone to improve speed when creating instances.
  44.         vb.linked_clone = true
  45.     end
  46.  
  47.     config.vm.define "rancher_node" do |rancher_node|
  48.         rancher_node.vm.network "private_network", :type => 'dhcp', :name => 'vboxnet0', :adapter => 2      
  49.         provision_shell_node rancher_node
  50.     end
  51.  
  52.     (1..1).each do |i|
  53.         config.vm.define "rancher_agent#{i}" do |rancher_agent|
  54.             rancher_agent.vm.network "private_network", :type => 'dhcp', :name => 'vboxnet0', :adapter => 2      
  55.             provision_shell_agent rancher_agent
  56.         end
  57.     end
  58.  
  59. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top