Guest User

vagrant mc

a guest
Dec 1st, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3.  
  4. # All Vagrant configuration is done below. The "2" in Vagrant.configure
  5. # configures the configuration version (we support older styles for
  6. # backwards compatibility). Please don't change it unless you know what
  7. # you're doing.
  8. Vagrant.configure(2) do |config|
  9. # The most common configuration options are documented and commented below.
  10. # For a complete reference, please see the online documentation at
  11. # https://docs.vagrantup.com.
  12.  
  13. ## **** by using this we can muliple virtual machine and also we can name the machine else it will get "default" as name"
  14. config.vm.define:opens do |opens_config|
  15.  
  16. # Every Vagrant development environment requires a box. You can search for
  17. # boxes at https://atlas.hashicorp.com/search.
  18.  
  19. opens_config.vm.box = "ubuntu/trusty64"
  20.  
  21. opens_config.vm.hostname = "opens"
  22. # opens_config.ssh.username = "stack"
  23. # opens_config.ssh.insert_key = "true"
  24. # opens_config.ssh.private_key_path = "/home/cooldharma06/.ssh/id_rsa_stack"
  25. # opens_config.ssh.keys_only = "true"
  26.  
  27.  
  28. # Disable automatic box update checking. If you disable this, then
  29. # boxes will only be checked for updates when the user runs
  30. # `vagrant box outdated`. This is not recommended.
  31. # config.vm.box_check_update = false
  32.  
  33. # Create a forwarded port mapping which allows access to a specific port
  34. # within the machine from a port on the host machine. In the example below,
  35. # accessing "localhost:8080" will access port 80 on the guest machine.
  36. # config.vm.network "forwarded_port", guest: 80, host: 8080
  37.  
  38. # Create a private network, which allows host-only access to the machine
  39. # using a specific IP.
  40. opens_config.vm.network :private_network, ip: "10.10.10.10", auto_config: "false"
  41.  
  42. opens_config.vm.provision "shell", run: "always", inline: "ifconfig eth0 10.10.10.10 netmask 255.255.255.0 up"
  43.  
  44. # Create a public network, which generally matched to bridged network.
  45. # Bridged networks make the machine appear as another physical device on
  46. # your network.
  47. # config.vm.network "public_network"
  48.  
  49. # Share an additional folder to the guest VM. The first argument is
  50. # the path on the host to the actual folder. The second argument is
  51. # the path on the guest to mount the folder. And the optional third
  52. # argument is a set of non-required options.
  53. # config.vm.synced_folder "../data", "/vagrant_data"
  54.  
  55. # Provider-specific configuration so you can fine-tune various
  56. # backing providers for Vagrant. These expose provider-specific options.
  57. # Example for VirtualBox:
  58. #
  59. opens_config.vm.provider "virtualbox" do |vb|
  60. # # Display the VirtualBox GUI when booting the machine
  61. # vb.gui = true
  62. #
  63. # # Customize the amount of memory on the VM:
  64. vb.memory = "4096"
  65. end
  66. #
  67. # View the documentation for the provider you are using for more
  68. # information on available options.
  69.  
  70. # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  71. # such as FTP and Heroku are also available. See the documentation at
  72. # https://docs.vagrantup.com/v2/push/atlas.html for more information.
  73. # config.push.define "atlas" do |push|
  74. # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  75. # end
  76.  
  77. # Enable provisioning with a shell script. Additional provisioners such as
  78. # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  79. # documentation for more information about their specific syntax and use.
  80. opens_config.vm.provision "shell", inline: <<-SHELL
  81. sudo apt-get update
  82. sudo apt-get install -y python
  83. password=stack
  84. pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
  85. sudo useradd -m -p $pass stack
  86. sudo echo "%stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
  87. SHELL
  88. end
  89.  
  90.  
  91. end
Add Comment
Please, Sign In to add comment