salt.pillar.git_pillar

Clone a remote git repository and use the filesystem as a Pillar source

Currently GitPython is the only supported provider for git Pillars

This external Pillar source can be configured in the master config file like so:

ext_pillar:
  - git: master git://gitserver/git-pillar.git root=subdirectory

The root= parameter is optional and used to set the subdirectory from where to look for Pillar files (such as top.sls).

Changed in version 2014.7.0: The optional root parameter will be added.

Changed in version 2015.5.0: The special branch name '__env__' will be replace by the environment ({{env}})

Note that this is not the same thing as configuring pillar data using the pillar_roots parameter. The branch referenced in the ext_pillar entry above (master), would evaluate to the base environment, so this branch needs to contain a top.sls with a base section in it, like this:

base:
  '*':
    - foo

To use other environments from the same git repo as git_pillar sources, just add additional lines, like so:

ext_pillar:
  - git: master git://gitserver/git-pillar.git
  - git: dev git://gitserver/git-pillar.git

To remap a specific branch to a specific environment separate the branch name and the environment name with a colon:

ext_pillar:
  - git: develop:dev git://gitserver/git-pillar.git
  - git: master:prod git://gitserver/git-pillar.git

In this case, the dev branch would need its own top.sls with a dev section in it, like this:

dev:
  '*':
    - bar

In a gitfs base setup with pillars from the same repository as the states, the ext_pillar: configuration would be like:

ext_pillar:
  - git: __env__ git://gitserver/git-pillar.git root=pillar

The (optional) root=pillar defines the directory that contains the pillar data. The corresponding top.sls would be like:

{{env}}:
  '*':
    - bar
class salt.pillar.git_pillar.GitPillar(branch, repo_location, opts)

Deal with the remote git repository for Pillar

envs()

Return a list of refs that can be used as environments

map_branch(branch, opts=None)
update()

Ensure you are following the latest changes on the remote

Return boolean whether it worked

salt.pillar.git_pillar.envs(branch, repo_location)

Return a list of refs that can be used as environments

salt.pillar.git_pillar.ext_pillar(minion_id, repo_string, pillar_dirs)

Execute a command and read the output as YAML

salt.pillar.git_pillar.update(branch, repo_location)

Ensure you are following the latest changes on the remote

return boolean whether it worked