Book Image

Learning SaltStack

By : Colton Myers
Book Image

Learning SaltStack

By: Colton Myers

Overview of this book

Table of Contents (15 chapters)

Managing groups of VMs with map files

So far, our exploration of Salt Cloud has been limited to operations on single VMs or manually compiled lists of VMs. This is very useful but doesn't scale as well because there's no central source of truth for your VMs, especially if you have VMs across multiple cloud providers.

Salt Cloud provides a tool to solve this problem: map files. Basically, we create a map of our infrastructure and all the VMs that are in it. When a map is executed, your infrastructure will be brought to the state defined in the map file. Any VMs that already exist will be unmodified, and any new VMs will be created.

Let's create a map file to create multiple Ubuntu and CentOS minions. The location of the map file is unimportant as we will pass in an absolute path to the map file anyway. Let's create it at /etc/salt/mymap.sls, as follows:

  - db1
  - db2
  - web1
  - web2
  - load

As you can see, cloud maps are also formatted in YAML. At their most basic, they consist...