Managing SALT configuration via git: Difference between revisions
Created page with "Category:SALT jgy-master:~ # cat /etc/salt/master.d/git.conf fileserver_backend: - git ext_pillar: - git: - main https://gitlab.com/jgy-servers/ahsoka.git: - user: jgyurci1 - password: glpat- - root: salts/pillar gitfs_env_whitelist: - main gitfs_provider: pygit2 gitfs_branch: main gitfs_remotes: - https://gitlab.com/jgy-servers/ahsoka: - user: jgyurci1 - password: glpat- - root: salts/salt - na..." |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category: | [[Category:SaltStack]] | ||
== Configure Salt Master with Git == | |||
This guide demonstrates how to configure a Salt Master to use Git as the source of states, pillars, and reactors. | |||
=== 1. Create Salt Master Git Configuration === | |||
Create or edit the config: | |||
/etc/salt/master.d/git.conf | |||
<syntaxhighlight lang="yaml"> | |||
fileserver_backend: | fileserver_backend: | ||
- git | - git | ||
| Line 8: | Line 17: | ||
ext_pillar: | ext_pillar: | ||
- git: | - git: | ||
- main https://gitlab.com/ | - main https://gitlab.com/tst-servers/ahsoka.git: | ||
- user: | - user: user | ||
- password: glpat- | - password: glpat-... | ||
- root: salts/pillar | - root: salts/pillar | ||
| Line 19: | Line 28: | ||
gitfs_branch: main | gitfs_branch: main | ||
gitfs_remotes: | gitfs_remotes: | ||
- https://gitlab.com/ | - https://gitlab.com/tst-servers/ahsoka: | ||
- user: | - user: user | ||
- password: glpat- | - password: glpat-... | ||
- root: salts/salt | - root: salts/salt | ||
- name: salt | - name: salt | ||
- https://gitlab.com/ | - https://gitlab.com/tst-servers/ahsoka: | ||
- user: | - user: user | ||
- password: glpat- | - password: glpat-... | ||
- root: salts/reactor | - root: salts/reactor | ||
- name: reactor | - name: reactor | ||
</syntaxhighlight> | |||
=== 2. Sync and Update Salt Data from Git === | |||
To apply the latest states and pillar data from Git, run: | |||
<syntaxhighlight lang="bash"> | |||
salt-run fileserver.update | |||
salt-run git_pillar.update | |||
</syntaxhighlight> | |||
=== 3. Apply States from the Main Branch === | |||
Apply all Salt states from the `main` environment: | |||
<syntaxhighlight lang="bash"> | |||
salt '*' state.apply saltenv=main | |||
</syntaxhighlight> | |||
Latest revision as of 15:27, 27 August 2025
Configure Salt Master with Git
This guide demonstrates how to configure a Salt Master to use Git as the source of states, pillars, and reactors.
1. Create Salt Master Git Configuration
Create or edit the config:
/etc/salt/master.d/git.conf
fileserver_backend:
- git
ext_pillar:
- git:
- main https://gitlab.com/tst-servers/ahsoka.git:
- user: user
- password: glpat-...
- root: salts/pillar
gitfs_env_whitelist:
- main
gitfs_provider: pygit2
gitfs_branch: main
gitfs_remotes:
- https://gitlab.com/tst-servers/ahsoka:
- user: user
- password: glpat-...
- root: salts/salt
- name: salt
- https://gitlab.com/tst-servers/ahsoka:
- user: user
- password: glpat-...
- root: salts/reactor
- name: reactor
2. Sync and Update Salt Data from Git
To apply the latest states and pillar data from Git, run:
salt-run fileserver.update
salt-run git_pillar.update
3. Apply States from the Main Branch
Apply all Salt states from the `main` environment:
salt '*' state.apply saltenv=main