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.
The OpenStack Nova module for Salt Cloud was bootstrapped from the OpenStack module for Salt Cloud, which uses a libcloud-based connection. The Nova module is designed to use the nova and glance modules already built into Salt.
These modules use the Python novaclient and glanceclient libraries, respectively. In order to use this module, the proper salt configuration must also be in place. This can be specified in the master config, the minion config, a set of grains or a set of pillars.
my_openstack_profile: keystone.user: admin keystone.password: verybadpass keystone.tenant: admin keystone.auth_url: 'http://127.0.0.1:5000/v2.0/'
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 currently requires the latest develop branch of Salt to be installed.
This module has been tested to work with HP Cloud and Rackspace. See the documentation for specific options for either of these providers. These examples could be set up in the cloud configuration at /etc/salt/cloud.providers
or /etc/salt/cloud.providers.d/openstack.conf
:
my-openstack-config: # The name of the configuration profile to use on said minion config_profile: my_openstack_profile ssh_key_name: mykey driver: nova userdata_file: /tmp/userdata.txt
To use keystoneauth1 instead of keystoneclient, include the use_keystoneauth option in the provider config.
Note
this is required to use keystone v3 as for authentication.
my-openstack-config: use_keystoneauth: True identity_url: 'https://controller:5000/v3' auth_version: 3 compute_name: nova compute_region: RegionOne service_type: compute verify: '/path/to/custom/certs/ca-bundle.crt' tenant: admin user: admin password: passwordgoeshere driver: nova
Note: by default the nova driver will attempt to verify its connection utilizing the system certificates. If you need to verify against another bundle of CA certificates or want to skip verification altogether you will need to specify the verify option. You can specify True or False to verify (or not) against system certificates, a path to a bundle or CA certs to check against, or None to allow keystoneauth to search for the certificates on its own.(defaults to True)
For local installations that only use private IP address ranges, the following option may be useful. Using the old syntax:
Note: For api use, you will need an auth plugin. The base novaclient does not support apikeys, but some providers such as rackspace have extended keystone to accept them
my-openstack-config: # Ignore IP addresses on this network for bootstrap ignore_cidr: 192.168.50.0/24 my-nova: identity_url: 'https://identity.api.rackspacecloud.com/v2.0/' compute_region: IAD user: myusername password: mypassword tenant: <userid> driver: nova my-api: identity_url: 'https://identity.api.rackspacecloud.com/v2.0/' compute_region: IAD user: myusername api_key: <api_key> os_auth_plugin: rackspace tenant: <userid> driver: nova networks: - net-id: 47a38ff2-fe21-4800-8604-42bd1848e743 - net-id: 00000000-0000-0000-0000-000000000000 - net-id: 11111111-1111-1111-1111-111111111111
This is an example profile.
debian8-2-iad-cloudqe4: provider: cloudqe4-iad size: performance1-2 image: Debian 8 (Jessie) (PVHVM) script_args: -UP -p python-zmq git 2015.8
and one using cinder volumes already attached
# create the block storage device centos7-2-iad-rackspace: provider: rackspace-iad size: general1-2 block_device: - source: image id: <image_id> dest: volume size: 100 shutdown: <preserve/remove> bootindex: 0 # with the volume already created centos7-2-iad-rackspace: provider: rackspace-iad size: general1-2 boot_volume: <volume id> # create the volume from a snapshot centos7-2-iad-rackspace: provider: rackspace-iad size: general1-2 snapshot: <cinder snapshot id> # create the create an extra ephemeral disk centos7-2-iad-rackspace: provider: rackspace-iad size: general1-2 ephemeral: - size: 100 format: <swap/ext4> # create the create an extra ephemeral disk centos7-2-iad-rackspace: provider: rackspace-iad size: general1-2 swap: <size>
Block Device can also be used for having more than one block storage device attached
centos7-2-iad-rackspace: provider: rackspace-iad size: general1-2 block_device: - source: image id: <image_id> dest: volume size: 100 shutdown: <preserve/remove> bootindex: 0 - source: blank dest: volume device: xvdc size: 100 shutdown: <preserve/remove>
Floating IPs can be auto assigned and ssh_interface can be set to fixed_ips, floating_ips, public_ips or private_ips
centos7-2-iad-rackspace: provider: rackspace-iad size: general1-2 ssh_interface: floating_ips floating_ip: auto_assign: True pool: public
Note: You must include the default net-ids when setting networks or the server will be created without the rest of the interfaces
Note: For rackconnect v3, rackconnectv3 needs to be specified with the rackconnect v3 cloud network as its variable.
Attach block volume
Return a dict of all available VM images on the cloud provider.
Return a list of locations
Return a dict of all available VM sizes on the cloud provider.
Determine if we should use an extra network to bootstrap Either 'False' (default) or 'True'.
Create a single VM from a data dict
Create and attach volumes to created node
Create block storage device
Delete a single VM
Associate a floating IP address to a server
New in version 2016.3.0.
Allocate a floating IP
New in version 2016.3.0.
De-allocate floating IP
New in version 2016.3.0.
Disassociate a floating IP from a server
New in version 2016.3.0.
List floating IPs
New in version 2016.3.0.
List all floating IP pools
New in version 2016.3.0.
Return the first configured instance.
Return a conn object for the passed VM data
Warn if dependencies aren't met.
Return the image object to use
Return the VM's size object
Return True if we are to ignore the specified IP. Compatible with IPv4.
Return a list of the VMs that in this location
Return a list of the VMs that in this location
Return a list of the VMs that in this location
Return a list of the VMs that are on the provider, with select fields
Determine if we should wait for the managed cloud automation before running. Either 'False' (default) or 'True'.
Create private networks
List private networks
Return the preferred Internet protocol. Either 'ipv4' (default) or 'ipv6'.
Determine if we should wait for rackconnect automation before running. Either 'False' (default) or 'True'.
Determine if server is using rackconnectv3 or not Return the rackconnect network name or False
Reboot a single VM
Put together all of the information necessary to request an instance through Novaclient and then fire off the request the instance.
Returns data about the instance
Return the script deployment object
Show the details from the provider concerning an instance
Return the ssh_interface type to connect to. Either 'public_ips' (default) or 'private_ips'.
Create private networks
Create private networks
Attach block volume
Create block storage device
Create and attach volumes to created node
Delete block storage device
Detach block volume
List block devices
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/clouds/all/salt.cloud.clouds.nova.html