forked from AndrewPickford/reclass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request madduck#71 from salt-formulas/andrewp-yaml-git
usable yaml_git and mixed storage types
- Loading branch information
Showing
3 changed files
with
155 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -577,3 +577,117 @@ This adds the subfolder to the node name and the structure above can then be use | |
... | ||
If the subfolder path starts with the underscore character ``_``, then the subfolder path is NOT added to the node name. | ||
|
||
|
||
Git storage type | ||
---------------- | ||
|
||
Reclass node and class yaml files can be read from a remote git repository with the yaml_git storage type. Use nodes_uri and | ||
classes_uri to define the git repos to use for nodes and classes. These can be the same repo. | ||
|
||
For salt masters using ssh connections the private and public keys must be readable by the salt daemon, which requires the | ||
private key NOT be password protected. For stand alone reclass using ssh connections if the privkey and pubkey options | ||
are not defined then any in memory key (from ssh-add) will be used. | ||
|
||
Salt master reclass config example: | ||
|
||
.. code-block:: yaml | ||
storage_type:yaml_git | ||
nodes_uri: | ||
# branch to use | ||
branch: master | ||
# cache directory (default: ~/.reclass/git/cache) | ||
cache_dir: /var/cache/reclass/git | ||
# lock directory (default: ~/.reclass/git/lock) | ||
lock_dir: /var/cache/reclass/lock | ||
# private key for ssh connections (no default, but will used keys stored | ||
# by ssh-add in memory if privkey and pubkey are not set) | ||
privkey: /root/salt_rsa | ||
# public key for ssh connections | ||
pubkey: /root/salt_rsa.pub | ||
repo: git+ssh://[email protected]:salt/nodes.git | ||
classes_uri: | ||
# branch to use or __env__ to use the branch matching the node | ||
# environment name | ||
branch: __env__ | ||
# cache directory (default: ~/.reclass/git/cache) | ||
cache_dir: /var/cache/reclass/git | ||
# lock directory (default: ~/.reclass/git/lock) | ||
lock_dir: /var/cache/reclass/lock | ||
# private key for ssh connections (no default, but will used keys stored | ||
# by ssh-add in memory if privkey and pubkey are not set) | ||
privkey: /root/salt_rsa | ||
# public key for ssh connections | ||
pubkey: /root/salt_rsa.pub | ||
# branch/env overrides for specific branches | ||
env_overrides: | ||
# prod env uses master branch | ||
- prod: | ||
branch: master | ||
# use master branch for nodes with no environment defined | ||
- none: | ||
branch: master | ||
repo: git+ssh://[email protected]:salt/site.git | ||
# root directory of the class hierarcy in git repo | ||
# defaults to root directory of git repo if not given | ||
root: classes | ||
Mixed storage type | ||
------------------ | ||
|
||
Use a mixture of storage types. | ||
|
||
Salt master reclass config example, which by default uses yaml_git storage but overrides the location for | ||
classes for the pre-prod environment to use a directory on the local disc: | ||
|
||
.. code-block:: yaml | ||
storage_type: mixed | ||
nodes_uri: | ||
# storage type to use | ||
storage_type: yaml_git | ||
# yaml_git storage options | ||
branch: master | ||
cache_dir: /var/cache/reclass/git | ||
lock_dir: /var/cache/reclass/lock | ||
privkey: /root/salt_rsa | ||
pubkey: /root/salt_rsa.pub | ||
repo: git+ssh://[email protected]:salt/nodes.git | ||
classes_uri: | ||
# storage type to use | ||
storage_type: yaml_git | ||
# yaml_git storage options | ||
branch: __env__ | ||
cache_dir: /var/cache/reclass/git | ||
lock_dir: /var/cache/reclass/lock | ||
privkey: /root/salt_rsa | ||
pubkey: /root/salt_rsa.pub | ||
repo: git+ssh://[email protected]:salt/site.git | ||
root: classes | ||
env_overrides: | ||
- prod: | ||
branch: master | ||
- none: | ||
branch: master | ||
- pre-prod: | ||
# override storage type for this environment | ||
storage_type: yaml_fs | ||
# options for yaml_fs storage type | ||
uri: /srv/salt/env/pre-prod/classes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters