ggiamarchi / vagrant-openstack-provider

Use Vagrant to manage OpenStack Cloud instances.
MIT License
247 stars 101 forks source link

Vagrant destroy is not deletings orchestrated stacks on Openstack and vagrant ssh not working #256

Closed rsingh2411 closed 8 years ago

rsingh2411 commented 8 years ago

Hi, I am able to bring Vms using heat template but there are few issues

  1. After Stack is created successfully following message is seen on console Either 'image' or 'volume_boot' configuration must be provided
  2. Vagrant ssh gives following output ==> default: The server hasn't been created yet. Run vagrant up first.
  3. Not able to destroy the stack using vagrant gives following message ==> default: The server hasn't been created yet. Run vagrant up first.

Any specific thing which i missed.

Following is Vagrant File

require 'vagrant-openstack-provider'
Vagrant.configure(2) do |config|
    config.ssh.pty = true
   config.ssh.username = "centos"
   config.vm.provider "openstack" do |os|
    os.openstack_auth_url = "https://url:5000/v2.0/"
    os.username = "test"
    os.password = "test"
    os.tenant_name = "Eng for Eng"
    os.openstack_network_url = "https://url:9696/v2.0/"
    os.openstack_image_url= "https://url:9292/v2.0/"
    os.networks = "public"
    os.stacks = [
     {
      name: 'mystack1',
      template: 'cfn_heat_template.yml'
     }]
  end
end

Following is heat template

parameters:
  Flavor:
   default: Micro-Small
   description: "Type of instance (flavor) to be used"
   label: "Instance Type"
   type: string
  Image:
    type: string
    description: Image
    default: "centos-7_x86_64-2015-01-27-v6"
  NetID:
    type: string
    description: External Network ID
    default: "2d84eaa4-8b81-4dc8-9897-dd8ef4719f8b"
  KeyName:
    description: "Name of key-pair to be used for the VMs"
    type: string
    default: test-key
resources:
  server_0:
    type: OS::Nova::Server
    properties:
      name: "server0"
      image: { get_param: Image }
      flavor: { get_param: Flavor }
      key_name: { get_param: KeyName }
      networks:
      - uuid: { get_param: NetID }
      security_groups:
        - default
outputs:
  server0_ip:
    description: IP of the server
    value: { get_attr: [ server_0, first_address ] }
~
ggiamarchi commented 8 years ago

The three problems you describe come from the fact you didn't define any machine in you Vagrantfile.

Heat stack support had been added to help create infrastructure prior vagrant machine creation. Your use case is a bit disconcerting because you don't create any server using Vagrant. Everything is in your heat stack. This use case does not requires Vagrant ; A basic Heat client should be good enough.

Here is an example using Vagrant + Heat to create a full infrastructure. Heat for network infrastructure (router, network, sub-network and the whole connectivity) and Vagrant for Instances.

You can definitely include servers in your heat stack if you don't need to manage them within Vagrant but you always need at least one machine managed by Vagrant.

ggiamarchi commented 8 years ago

Closing for long inactive time