salt.cloud.clouds.openstack

OpenStack Cloud Module

OpenStack is an open source project that is in use by a number a cloud providers, each of which have their own ways of using it.

depends:libcloud >= 0.13.2

OpenStack provides a number of ways to authenticate. This module uses password- based authentication, using auth v2.0. It is likely to start supporting other methods of authentication provided by OpenStack in the future.

Note that there is currently a dependency upon netaddr. This can be installed on Debian-based systems by means of the python-netaddr package.

This module has been tested to work with HP Cloud and Rackspace. See the documentation for specific options for either of these providers. Some examples, using the old cloud configuration syntax, are provided below:

Set up in the cloud configuration at /etc/salt/cloud.providers or /etc/salt/cloud.providers.d/openstack.conf:

my-openstack-config:
  # The OpenStack identity service url
  identity_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/
  # The OpenStack compute region
  compute_region: region-b.geo-1
  # The OpenStack compute service name
  compute_name: Compute
  # The OpenStack tenant name (not tenant ID)
  tenant: myuser-tenant1
  # The OpenStack user name
  user: myuser
  # The OpenStack keypair name
  ssh_key_name: mykey
  # Skip SSL certificate validation
  insecure: false
  # The ssh key file
  ssh_key_file: /path/to/keyfile/test.pem
  # The OpenStack network UUIDs
  networks:
      - fixed:
          - 4402cd51-37ee-435e-a966-8245956dc0e6
      - floating:
          - Ext-Net
  files:
      /path/to/dest.txt:
          /local/path/to/src.txt
  # Skips the service catalog API endpoint, and uses the following
  base_url: http://192.168.1.101:3000/v2/12345
  driver: openstack
  userdata_file: /tmp/userdata.txt
  # config_drive is required for userdata at rackspace
  config_drive: True

For in-house Openstack Essex installation, libcloud needs the service_type :

my-openstack-config:
  identity_url: 'http://control.openstack.example.org:5000/v2.0/'
  compute_name : Compute Service
  service_type : compute

Either a password or an API key must also be specified:

my-openstack-password-or-api-config:
  # The OpenStack password
  password: letmein
  # The OpenStack API key
  apikey: 901d3f579h23c8v73q9

Optionally, if you don't want to save plain-text password in your configuration file, you can use keyring:

my-openstack-keyring-config:
  # The OpenStack password is stored in keyring
  # don't forget to set the password by running something like:
  # salt-cloud --set-password=myuser my-openstack-keyring-config
  password: USE_KEYRING

For local installations that only use private IP address ranges, the following option may be useful. Using the old syntax:

my-openstack-config:
  # Ignore IP addresses on this network for bootstrap
  ignore_cidr: 192.168.50.0/24

It is possible to upload a small set of files (no more than 5, and nothing too large) to the remote server. Generally this should not be needed, as salt itself can upload to the server after it is spun up, with nowhere near the same restrictions.

my-openstack-config:
  files:
      /path/to/dest.txt:
          /local/path/to/src.txt

Alternatively, one could use the private IP to connect by specifying:

my-openstack-config:
  ssh_interface: private_ips
salt.cloud.clouds.openstack.avail_images(conn=None, call=None)

Return a dict of all available VM images on the cloud provider with relevant data

salt.cloud.clouds.openstack.avail_locations(conn=None, call=None)

返回一个字典,包含所有在云服务商可用的VM路径和相关数据

salt.cloud.clouds.openstack.avail_sizes(conn=None, call=None)

Return a dict of all available VM images on the cloud provider with relevant data

salt.cloud.clouds.openstack.create(vm_)

从一个字典数据中创建单一的VM

salt.cloud.clouds.openstack.destroy(name, conn=None, call=None)

Delete a single VM

salt.cloud.clouds.openstack.get_configured_provider()

Return the first configured instance.

salt.cloud.clouds.openstack.get_conn()

Return a conn object for the passed VM data

salt.cloud.clouds.openstack.get_dependencies()

Warn if dependencies aren't met.

salt.cloud.clouds.openstack.get_image(conn, vm_)

Return the image object to use

salt.cloud.clouds.openstack.get_node(conn, name)

Return a libcloud node for the named VM

salt.cloud.clouds.openstack.get_size(conn, vm_)

Return the VM's size object

salt.cloud.clouds.openstack.ignore_cidr(vm_, ip)

Return True if we are to ignore the specified IP. Compatible with IPv4.

salt.cloud.clouds.openstack.list_nodes(conn=None, call=None)

Return a list of the VMs that are on the provider

salt.cloud.clouds.openstack.list_nodes_full(conn=None, call=None)

Return a list of the VMs that are on the provider, with all fields

salt.cloud.clouds.openstack.list_nodes_select(conn=None, call=None)

Return a list of the VMs that are on the provider, with select fields

salt.cloud.clouds.openstack.managedcloud(vm_)

Determine if we should wait for the managed cloud automation before running. Either 'False' (default) or 'True'.

salt.cloud.clouds.openstack.networks(vm_, kwargs=None)
salt.cloud.clouds.openstack.preferred_ip(vm_, ips)

Return the preferred Internet protocol. Either 'ipv4' (default) or 'ipv6'.

salt.cloud.clouds.openstack.rackconnect(vm_)

Determine if we should wait for rackconnect automation before running. Either 'False' (default) or 'True'.

salt.cloud.clouds.openstack.reboot(name, conn=None)

Reboot a single VM

salt.cloud.clouds.openstack.request_instance(vm_=None, call=None)

Put together all of the information necessary to request an instance on Openstack and then fire off the request the instance.

Returns data about the instance

salt.cloud.clouds.openstack.script(vm_)

Return the script deployment object

salt.cloud.clouds.openstack.show_instance(name, call=None)

Show the details from the provider concerning an instance

salt.cloud.clouds.openstack.ssh_interface(vm_)

Return the ssh_interface type to connect to. Either 'public_ips' (default) or 'private_ips'.