Will there be any problems if SaltStack dirs are subdirs of /srv/salt?

Most of the examples -- and also the documentation -- of SaltStack put the states files under /srv/salt and the pillars files under /srv/pillar.

This means if I want to track the files using a source control (Mercurial or Git), I have to create two repositories.

Now, I want place the states files and the pillars files as subdirectories under /srv/salt. Or, in other words, I will get the following directory structure (after hg init on /srv/salt):

/srv/salt   + .hg/   + states/   + pillars/ 

Will this cause any problems with SaltStack?

Or do you have a better recommendation so that I can have only one source control repository for both the states and the pillars?

Replay

You can define additional file roots for both files in /etc/salt/master:

file_roots:
  base:
    - /srv/salt
  joe:
    - /home/joe/hg/salt

pillar_roots:
  base:
    - /srv/pillar
  joe:
    - /home/joe/hg/salt/pillar

By default Salt does something that is very confusing: it combines all of the pillar roots together. You avoid this by running salt against the root that containts your repository

sudo salt '*' state.highstate test=True saltenv=joe

The only problem is that your top-level routes won't be visible. The documenation suggests base, but it can be anything, including template variables:

top.sls:

{{saltenv}}:
  '*':
    - defaults

pillar/top.sls:

{{saltenv}}:
  '*':
    - globals

Note that base doesn't need to exist at all, but you can access it again by specifying saltenv when you run a state file:

sudo salt 'www1*' state.sls wordpress saltenv=base

Category: saltstack Time: 2016-07-28 Views: 0
Tags: saltstack

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 3.081 (s). 13 q(s)