A number of options exist when creating virtual machines. They can be managed
directly from profiles and the command line execution, or a more complex map
file can be created. The map file allows for a number of virtual machines to
be created and associated with specific profiles. The map file is designed to
be run once to create these more complex scenarios using salt-cloud.

Map files have a simple format, specify a profile and then a list of virtual
machines to make from said profile:

This map file can then be called to roll out all of these virtual machines. Map
files are called from the salt-cloud command with the -m option:

$ salt-cloud -m /path/to/mapfile

Remember, that as with direct profile provisioning the -P option can be passed
to create the virtual machines in parallel:

$ salt-cloud -m /path/to/mapfile -P

Note

Due to limitations in the GoGrid API, instances cannot be provisioned in parallel
with the GoGrid driver. Map files will work with GoGrid, but the -P
argument should not be used on maps referencing GoGrid instances.

A map file can also be enforced to represent the total state of a cloud
deployment by using the --hard option. When using the hard option any vms
that exist but are not specified in the map file will be destroyed:

$ salt-cloud -m /path/to/mapfile -P -H

Be careful with this argument, it is very dangerous! In fact, it is so
dangerous that in order to use it, you must explicitly enable it in the main
configuration file.

Any top level data element from your profile may be overridden in the map file:

fedora_small:-web1:size:t2.micro-web2:size:t2.nano

As of Salt 2017.7.0, nested elements are merged, and can can be specified
individually without having to repeat the complete definition for each top
level data element. In this example a separate MAC is assigned to each VMware
instance while inheriting device parameters for for disk and network
configuration:

$ salt-cloud -m /path/to/mapfile -d
The following virtual machines are set to be destroyed:
web1
web2
Proceed? [N/y]

Warning

Specifying Nodes with Maps on the Command Line
Specifying the name of a node or nodes with the maps options on the command
line is not supported. This is especially important to remember when
using --destroy with maps; salt-cloud will ignore any arguments
passed in which are not directly relevant to the map file. When using
``--destroy`` with a map, every node in the map file will be deleted!
Maps don't provide any useful information for destroying individual nodes,
and should not be used to destroy a subset of a map.

When using modules that access the CloudClient directly (notably, the
cloud execution and runner modules), it is possible to pass in the contents
of a map file, rather than a path to the location of the map file.

Normally when using these modules, the path to the map file is passed in using: