[Container-tools] Fwd: Help on Vagrant -CDK

Lalatendu Mohanty lmohanty at redhat.com
Thu Sep 8 19:24:27 UTC 2016


Looks like like I some how denied the mail in the container-tools admin 
interface. Sorry about that.

-------- Forwarded Message --------
Subject: 	Help on Vagrant -CDK
Date: 	Thu, 8 Sep 2016 17:32:19 +0000
From: 	Chelapurath, Mendus <Mendus.Chelapurath at ssa.gov>
To: 	container-tools at redhat.com <container-tools at redhat.com>



I am having trouble getting vagrant file executed in an order so that I 
can edit some of my virtual box configuration files before the 
subscription takes place.
Since I am running everything behind self-signed ssl proxy
Here is the Vagrant File Also note that I am using vagrant registration 
and proxy pluginbut they are not sufficient to deal with all 
configuration needed for self-signed proxy
=======================================================================
# -*- mode: ruby -*-
# vi: set ft=ruby :
# The private network IP of the VM. You will use this IP to connect to 
OpenShift.
PUBLIC_ADDRESS="10.1.2.2"
# Number of virtualized CPUs
VM_CPU = ENV['VM_CPU'] || 2
# Amount of available RAM
VM_MEMORY = ENV['VM_MEMORY'] || 3072
# Validate required plugins
REQUIRED_PLUGINS = %w(vagrant-service-manager vagrant-registration)
errors = []
def message(name)
   "#{name} plugin is not installed, run `vagrant plugin install 
#{name}` to install it."
end
# Validate and collect error message if plugin is not installed
REQUIRED_PLUGINS.each { |plugin| errors << message(plugin) unless 
Vagrant.has_plugin?(plugin) }
unless errors.empty?
   msg = errors.size > 1 ? "Errors: \n* #{errors.join("\n* ")}" : 
"Error: #{errors.first}"
   fail Vagrant::Errors::VagrantError.new, msg
end
Vagrant.configure(2) do |config|
   config.vm.box = "cdkv2"
# I want this be executed before RHEL subscription
config.vm.provision "bootstrap", type: "shell" do |s|
     s.inline = "sed -i '/insecure = 0/c\insecure = 1' /etc/rhsm/rhsm.conf"
     s.inline = "echo INSECURE_REGISTRY=--insecure-registry 
registry.access.redhat.com --insecure-registry index.docker.io 
--insecure-registry docker.io  >> /etc/sysconfig/docker"
   end
# I want this be executed before RHEL subscription  (part of the proxy 
plugin)
   if Vagrant.has_plugin?("vagrant-proxyconf")
     config.proxy.http     = "_http://xxxx:xxxxx@access.l.gov:80__0__/_ 
<http://xxxx:xxxxx@access.l.gov:800/>"
     config.proxy.https    = "_http://xxx:xxxx1@access.b..gov:80_0"
     config.proxy.no_proxy = "localhost,127.0.0.1,.ssa.gov,10.1.2.2"
   end
   config.vm.provider "virtualbox" do |v, override|
     v.memory = VM_MEMORY
     v.cpus   = VM_CPU
     v.name   = "OSE-CDK"
     v.customize ["modifyvm", :id, "--ioapic", "on"]
     v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
   end
   config.vm.provider "libvirt" do |v, override|
     v.memory = VM_MEMORY
     v.cpus   = VM_CPU
     v.driver = "kvm"
   end
   config.vm.network "private_network", ip: "#{PUBLIC_ADDRESS}"
# I want this be executed before RHEL subscription (part of the 
registration plugin)
if ENV.has_key?('SUB_USERNAME') && ENV.has_key?('SUB_PASSWORD')
      config.registration.username = ENV['SUB_USERNAME']
      config.registration.password = ENV['SUB_PASSWORD']
      config.registration.proxy = 'access.l.gov:800'
config.registration.proxyUser = 'xxxx'
config.registration.proxyPassword = 'xxxx'
   end
   config.servicemanager.services = "docker"
   config.vm.provision "shell", run: "always", inline: <<-SHELL
     systemctl enable openshift 2>&1
     systemctl start openshift
   SHELL
   config.vm.provision "shell", run: "always", inline: <<-SHELL
     echo
     echo "Successfully started and provisioned VM with #{VM_CPU} cores 
and #{VM_MEMORY} MB of memory."
     echo "To modify the number of cores and/or available memory set the 
environment variables"
     echo "VM_CPU respectively VM_MEMORY."
     echo
     echo "You can now access the OpenShift console on: 
_https://#{PUBLIC_ADDRESS}:8443/console_ 
<https://#%7BPUBLIC_ADDRESS%7D:8443/console>"
     echo
     echo "To use OpenShift CLI, run:"
     echo "$ vagrant ssh"
     echo "$ oc login #{PUBLIC_ADDRESS}:8443"
     echo
     echo "Configured users are (<username>/<password>):"
     echo "openshift-dev/devel"
     echo "admin/admin"
     echo
     echo "If you have the oc client library on your host, you can also 
login from your host."
     echo
   SHELL
end
Here is the output on vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'cdkv2'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: OSE-CDK
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
     default: Adapter 1: nat
     default: Adapter 2: hostonly
==> default: Forwarding ports...
     default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
     default: SSH address: 127.0.0.1:2222
     default: SSH username: vagrant
     default: SSH auth method: private key
     default:
     default: Vagrant insecure key detected. Vagrant will automatically 
replace
     default: this with a newly generated keypair for better security.
     default:
     default: Inserting generated public key within guest...
     default: Removing insecure key from the guest if it's present...
     default: Key inserted! Disconnecting and reconnecting using new SSH 
key...
==> default: Machine booted and ready!
==> default: Registering box with vagrant-registration...
     default: Would you like to register the system now (default: yes)? 
[y|n]y
     default: username: _mendus.chelapurath at gmail.com_ 
<mailto:mendus.chelapurath at gmail.com>
     default: password:
Error! Your console doesn't support hiding input. We'll ask for
input again below, but we WILL NOT be able to hide input. If this
is a problem for you, ctrl-C to exit and fix your stdin.
      default: password: xxxx
     default: password:
Error! Your console doesn't support hiding input. We'll ask for
input again below, but we WILL NOT be able to hide input. If this
is a problem for you, ctrl-C to exit and fix your stdin.
      default: password: xxxx
==> default: Invalid username/password. Try again (3/3)
     default: username: _mendus.chelapurath at gmail.com_ 
<mailto:mendus.chelapurath at gmail.com>
     default: password:
Error! Your console doesn't support hiding input. We'll ask for
input again below, but we WILL NOT be able to hide input. If this
is a problem for you, ctrl-C to exit and fix your stdin.
      default: password: xxxxxx
==> default: Invalid credentials.
==> default: Registering to: 
subscription.rhn.redhat.com:443/subscription The system has been 
registered with ID: ef1f4b1d-7819-4707-8159-cd5831890abd
thanks
*Mendus Chelapurath*
*Cell Ph**: 443-850-7259*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/container-tools/attachments/20160909/0e55749d/attachment.htm>


More information about the Container-tools mailing list