Comments (3)
FWIW I got around this by naming my gitfs source that the pillar data resides in with a constant name like:
gitfs_remotes:
- [email protected]:<username>/my-salt-config-repo.git:
- name: my-salt-config-repo-name
Then I just set the source to point to that directory via:
ext_pillar:
- tower: /var/cache/salt/master/git_pillar/my-salt-config-repo-name/relative/path/to/tower.sls
I'll spend some time trying to get this working natively when I have free time 🤣 I hope soon
from salt-tower.
I am usually checking out repositories on the master with the salt minion.
State:
/srv/salt/:
file.directory:
- makedirs: True
{% for name, conf in salt['pillar.get']('salt:repositories', {}).items() %}
/srv/salt/{{ name }}:
git.latest:
- name: {{ conf['url'] }}
- rev: {{ conf['rev'] }}
- target: /srv/salt/{{ name }}
- force_fetch: True
- force_reset: True
- require:
- file: /srv/salt/
- watch_in:
- cmd: salt/repositories/sync_all
{% endfor %}
salt/repositories/sync_all:
cmd.wait:
- name: salt-run --log-level warning saltutil.sync_all
Pillar example:
salt:
repositories:
states:
url: ssh://.../states.git
rev: main
pillar:
url: ssh://.../pillars.git
rev: main
reactors:
url: ssh://.../reactors.git
rev: main
# ...
master:
file_roots:
base:
- /srv/salt/states
pillar_roots:
base:
- /srv/salt/pillar
gitfs_remotes:
- https://github.com/jgraichen/salt-tower.git:
- base: v1.7.0
ext_pillar:
- tower: /srv/salt/pillar/tower.sls
# ...
A small daemon is running there, receiving webhooks when commits are pushed, running salt-call state.apply salt/master/repositories
(the state file above) on the salt master. In some cases the webhook daemon is only creating/updating a file in /run
which is monitored by the salt minion via a beacon due to privilege separation. This results in usually less than one second until changes are live.
I do assume that the biggest problem with "native" git support will be calling the salt renderers and have e.g. JINJA import working correctly.
from salt-tower.
I initially tried maintaining local copies of the git repo on the master but I like having my development master refresh its file cache every minute or so for easy testing and I didn't want to have the minion on it always locked running a state.apply, even if you drop to 5min that recurring lock gets somewhat annoying. I'm always on the fence about it however.
I really like the webhook concept coupled with the beacon/reactor state.. I may have to swap over to that. Much less load and even faster update times. Yeah.. this is a great idea, thank you. Even if/when tower gets native gifts backing it wouldn't come close to the update speed of that setup 🚀
When I have time to look in to this I'll check out how gitstack handles it natively.. I only tested with that system for a short time but I think it rendered and handled imports in the expected way at the time.
from salt-tower.
Related Issues (11)
- Missing tower data file should be error or option HOT 1
- Imports happen relative to state dir rather than pillar? HOT 5
- Late-bind variable interpolation via YAML tag
- when using with salt-ssh, tower runs twice and final pillar data gets wrong HOT 3
- Dependency Dashboard
- Configure salt environments directly in ext_pillar configuration
- tower.sls rendering ignores env HOT 1
- Late-bound variable replacement HOT 2
- feature plans HOT 14
- how to debug errors HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from salt-tower.