2016-03-07 23:06:16 +00:00
|
|
|
.. _salt-cloud-map:
|
|
|
|
|
2012-06-24 03:18:05 +00:00
|
|
|
==============
|
|
|
|
Cloud Map File
|
|
|
|
==============
|
|
|
|
|
|
|
|
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
|
2012-08-01 15:41:52 +00:00
|
|
|
file can be created. The map file allows for a number of virtual machines to
|
[develop] Merge forward from 2016.3 to develop (#33193)
* Add run_on_start docs to schedule.rst (#32958)
Fixes #22580
* Backport #33021 manually to 2015.5 (#33044)
* Saltfile with pillar tests (#33045)
* add file.managed with pillar data tests
* do not require git for other tests
* Fix minor document error of test.assertion (#33067)
* test pillar.items output (#33060)
* File and User test fixes for 2015.5 on Fedora23 (#33055)
* Fix file_test.test_symlink on 2015.5
* Fix failing user present test
* add test for installing package while using salt-call --local (#33025)
* add test for installing package while using salt-call --local
* fix pylint
* ssh docs: install py-2.6 for RHEL 5
* Bugfix: Restore boolean values from the repo configuration
* Add test data for repos
* Add repo config test
* Bugfix (follow-up): setting priority requires non-positive integer
* modules.npm: do not log npm --version at info level (#33084)
* salt-cloud: fix ipv6-only virtual machines (#32865)
* salt-cloud: fix ipv6-only virtual machines
* fix hostname for rsync fallback in scp_file function
* use 4 spaces instead of 2
* remove global variable, use direct socket call instead
* Use saltstack repo in buildpackage.py on CentOS 5 (#33080)
* Lower display of msgpack failure msg to debug (#33078)
Closes #33074
* cloud.query needs to define mapper.opts (#33098)
* clarify docs that map is designed to be run once. is not stateful (#33102)
* Moved _finger_fail method to parent class.
Method _finger_fail method from SAuth to AsyncAuth class to make method available
in both class and fix an issue where _finger_Fail is called inside AsyncAuth.
* Fix 33058 (#33099)
* Fix servermanager module
- Added check for 2008 version of windows
- Added Import-Module ServerManager to _pshell_json.
Apparently this needs to run each time we issue a
servermanager command.
* Fix list_available
* salt.utils.gitfs: fix formatting for warning messages (#33064)
* salt.utils.gitfs: fix formatting for warning messages
When git_pillar support was added to salt.utils.gitfs, the
recommendation globals had string formatting placeholders added to them,
but the locations where these values are referenced do not call
``.format()`` to properly replace them. This commit fixes that
oversight.
* Remove more gitfs and master-specific wording from log messages
* Add a check that the cmdline of the found proc matches (#33129)
* Doc mock decorators (#33132)
* Add mock function for mocking decorators
* Mock the stdlib user module because importing it will open the repl
* Fix broken parsing of usermgmt.conf on OpenBSD (#33135)
When creating a new user, if a group of the same name already exists,
the usermgmt.conf file is consulted to determine the primary group.
It's in these cases that the parsing bug is triggered.
This code change addresses several of the existing issues:
- The previous split statement explicitly specified a single space.
Since a config line may have any number of spaces and/or tabs
surrounding the entries, the resulting array's elements may be
incorrect.
- According to the man pages for usermgmt.conf, the "group" config
entry accpets a single parameter -- so we shouldn't iterate.
- The "val[1]" was returning the 2nd letter of each word and not the
second word on the config line as intended.
* Move salt-ssh thin dir location to /var/tmp (#33130)
* Move salt-ssh thin dir location to /var/tmp
Closes #32771
* Remove performance penelty language
* If cache_jobs: True is set, populate the local job cache when running salt-call (#33100)
* If cache_jobs: True is set, populate the local job cache
Fixes #32834
Allows a masterless minion to query the job cache.
* Refactor cache_jobs functionality to be DRY
* Skipping salt-call --local test
* Back-port #31769 to 2015.8 (#33139)
* Handle empty acl_name in linux_acl state
Calls to setfacl interpret an empty group or user name to mean to be the
owner of the file they're operating on. For example, for a directory
owned by group 'admin', the ACL 'default:group::rwx' is equivalent to
'default:group:admin:rwx'.
The output of the getfacl execution module returns ACLs in the format of
'group:admin:rwx' instead of 'group::rwx'. This commit changes the
acl.present state to look for the owner of the file if the acl_name
paremeter is empty.
* Fix acl.present/acl.absent changing default ACLs
The behaviour of the acl.present and acl.absent is to check the data
structure returned by getfacl contains a key by the name of acl_type.
However, this data structure does not contain any default ACLs if none
exist, so this check will fail. We omit the check if a default ACL was
passed into the state functions.
Unfortunately, the call to modfacl may fail if the user passes in an
acl_type such as 'default:random'. In this case the state will appear to
succeed, but do nothing.
This fixes the state module to allow setting default ACLs on files which
have none.
* Fix regression in 2016.3 HEAD when version is specified (#33146)
Resolves #33013.
* Hash fileclients by opts (#33142)
* Hash fileclients by opts
There was an issue whereby the cache of the fileclient was being overwritten
by dueling minion instances in multimaster mode. This protects them by hashing
by the id of opts.
Closes #25040
* Silly typo!
* Remove tests which do not test any actual functionality or are too tightly coupled to the implementation
* Strip ldap fqdn (#33127)
* Add option to strip off domain names on computer names that come from LDAP/AD
* Add strip_domains option for ldap.
* Add documentation for auth.ldap.minion_stripdomains.
* [2015.5] Update to latest bootstrap script v2016.05.10 (#33155)
* [2015.8] Update to latest bootstrap script v2016.05.10 (#33156)
* [2016.3] Update to latest bootstrap script v2016.05.10 (#33157)
* add 2015.5.11 release notes (#33160)
* add 2015.8.9 release notes (#33161)
* Pip fix (#33180)
* fix pip!!
* make it work with old pip as well
* Added resiliency
* Don't need to check, just get the right name
* [2015.5] Update to latest bootstrap script v2016.05.11 (#33185)
2016-05-12 14:53:39 +00:00
|
|
|
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.
|
2012-06-24 03:18:05 +00:00
|
|
|
|
|
|
|
Map files have a simple format, specify a profile and then a list of virtual
|
|
|
|
machines to make from said profile:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
2012-08-01 15:41:52 +00:00
|
|
|
fedora_small:
|
2013-11-22 21:33:09 +00:00
|
|
|
- web1
|
|
|
|
- web2
|
|
|
|
- web3
|
2012-06-24 03:18:05 +00:00
|
|
|
fedora_high:
|
2013-11-22 21:33:09 +00:00
|
|
|
- redis1
|
|
|
|
- redis2
|
|
|
|
- redis3
|
2012-06-24 03:18:05 +00:00
|
|
|
cent_high:
|
2013-11-22 21:33:09 +00:00
|
|
|
- riak1
|
|
|
|
- riak2
|
|
|
|
- riak3
|
2012-06-24 03:18:05 +00:00
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ 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:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ salt-cloud -m /path/to/mapfile -P
|
2012-08-01 15:41:52 +00:00
|
|
|
|
2015-06-18 20:25:20 +00:00
|
|
|
.. 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.
|
|
|
|
|
2012-08-01 15:41:52 +00:00
|
|
|
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:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ salt-cloud -m /path/to/mapfile -P -H
|
2012-09-21 20:18:33 +00:00
|
|
|
|
2013-02-08 18:16:51 +00:00
|
|
|
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.
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
enable_hard_maps: True
|
|
|
|
|
2013-03-14 01:21:00 +00:00
|
|
|
A map file can include grains and minion configuration options:
|
2012-09-21 20:18:33 +00:00
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
fedora_small:
|
2013-11-22 21:33:42 +00:00
|
|
|
- web1:
|
|
|
|
minion:
|
|
|
|
log_level: debug
|
|
|
|
grains:
|
|
|
|
cheese: tasty
|
|
|
|
omelet: du fromage
|
|
|
|
- web2:
|
|
|
|
minion:
|
|
|
|
log_level: warn
|
|
|
|
grains:
|
|
|
|
cheese: more tasty
|
|
|
|
omelet: with peppers
|
2012-09-21 20:18:33 +00:00
|
|
|
|
2012-10-12 17:58:59 +00:00
|
|
|
A map file may also be used with the various query options:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ salt-cloud -m /path/to/mapfile -Q
|
2013-11-22 17:56:57 +00:00
|
|
|
{'ec2': {'web1': {'id': 'i-e6aqfegb',
|
2012-10-12 17:58:59 +00:00
|
|
|
'image': None,
|
|
|
|
'private_ips': [],
|
|
|
|
'public_ips': [],
|
|
|
|
'size': None,
|
|
|
|
'state': 0}},
|
|
|
|
'web2': {'Absent'}}
|
|
|
|
|
|
|
|
...or with the delete option:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ salt-cloud -m /path/to/mapfile -d
|
|
|
|
The following virtual machines are set to be destroyed:
|
|
|
|
web1
|
|
|
|
web2
|
|
|
|
|
|
|
|
Proceed? [N/y]
|
|
|
|
|
2015-06-01 21:25:58 +00:00
|
|
|
.. 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.
|
|
|
|
|
2014-02-14 23:53:55 +00:00
|
|
|
|
|
|
|
Setting up New Salt Masters
|
|
|
|
===========================
|
|
|
|
|
|
|
|
Bootstrapping a new master in the map is as simple as:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
fedora_small:
|
2014-06-06 01:34:13 +00:00
|
|
|
- web1:
|
|
|
|
make_master: True
|
2014-02-14 23:53:55 +00:00
|
|
|
- web2
|
|
|
|
- web3
|
|
|
|
|
2014-12-11 15:51:43 +00:00
|
|
|
Notice that **ALL** bootstrapped minions from the map will answer to the newly
|
2014-02-14 23:53:55 +00:00
|
|
|
created salt-master.
|
|
|
|
|
2014-12-11 15:51:43 +00:00
|
|
|
To make any of the bootstrapped minions answer to the bootstrapping salt-master
|
2014-02-15 10:23:07 +00:00
|
|
|
as opposed to the newly created salt-master, as an example:
|
2014-02-14 23:53:55 +00:00
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
fedora_small:
|
2014-06-06 01:34:13 +00:00
|
|
|
- web1:
|
|
|
|
make_master: True
|
|
|
|
minion:
|
|
|
|
master: <the local master ip address>
|
|
|
|
local_master: True
|
2014-02-14 23:53:55 +00:00
|
|
|
- web2
|
|
|
|
- web3
|
2014-02-15 00:03:46 +00:00
|
|
|
|
|
|
|
|
2014-12-11 15:51:43 +00:00
|
|
|
The above says the minion running on the newly created salt-master responds to
|
2014-02-15 00:03:46 +00:00
|
|
|
the local master, ie, the master used to bootstrap these VMs.
|
|
|
|
|
|
|
|
Another example:
|
|
|
|
|
|
|
|
.. code-block:: yaml
|
|
|
|
|
|
|
|
fedora_small:
|
2014-06-06 01:34:13 +00:00
|
|
|
- web1:
|
|
|
|
make_master: True
|
2014-02-15 00:03:46 +00:00
|
|
|
- web2
|
2014-06-06 01:34:13 +00:00
|
|
|
- web3:
|
|
|
|
minion:
|
|
|
|
master: <the local master ip address>
|
|
|
|
local_master: True
|
2014-02-15 00:03:46 +00:00
|
|
|
|
2014-12-11 15:51:43 +00:00
|
|
|
The above example makes the ``web3`` minion answer to the local master, not the
|
2015-06-01 21:25:58 +00:00
|
|
|
newly created master.
|