saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.19k stars 5.48k forks source link

problem when use gitfs with salt #11371

Closed justlooks closed 10 years ago

justlooks commented 10 years ago

my master config without enable gitfs

rpm -qa|grep salt

salt-2014.1.0-1.el6.noarch

grep '^[^#]' /etc/salt/master

default_include: master.d/*.conf interface: 192.168.10.231 file_recv: True file_roots: base:

when i run job ,it's ok

salt 'saltslave' state.highstate

saltslave:

      ID: /tmp/mytest.sh
Function: file.managed
  Result: True
 Comment: File /tmp/mytest.sh updated
 Changes:
          ----------
          diff:
              ---
              +++
              @@ -1,1 +1,3 @@
              -from saltslave2
              +#!/bin/bash
              +
              +echo test

Summary

Succeeded: 1

Failed: 0

Total: 1

create a new repo in git ,and put all file in /srv into it

git clone git@192.168.10.240:mysaltrepo.git

Initialized empty Git repository in /opt/mysaltrepo/.git/ warning: You appear to have cloned an empty repository.

cd mysaltrepo/

cp -av /srv/* .

/srv/salt' ->./salt' /srv/salt/top.sls' ->./salt/top.sls' /srv/salt/mytest' ->./salt/mytest' /srv/salt/mytest/mytest.sh' ->./salt/mytest/mytest.sh' /srv/salt/mytest/init.sls' ->./salt/mytest/init.sls' /srv/top.sls' ->./top.sls'

git add .

git commit -m "first try"

[master (root-commit) c6d30c9] first try Committer: root root@saltmaster.(none) Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly:

git config --global user.name "Your Name"
git config --global user.email you@example.com

If the identity used for this commit is wrong, you can fix it with:

git commit --amend --author='Your Name <you@example.com>'

4 files changed, 12 insertions(+), 0 deletions(-) create mode 100644 salt/mytest/init.sls create mode 100644 salt/mytest/mytest.sh create mode 100644 salt/top.sls create mode 100644 top.sls

push to remote git server

git push origin master

Counting objects: 8, done. Compressing objects: 100% (5/5), done. Writing objects: 100% (8/8), 557 bytes, done. Total 8 (delta 0), reused 0 (delta 0) To git@192.168.10.240:mysaltrepo.git

uncomment following info in /etc/salt/master

gitfs_remotes:

and move /srv to /srv_del

mv /srv /srv_del

and restart salt master

salt 'saltslave' state.highstate

saltslave:

Data failed to compile:

No matching sls found for 'servers.vim2' in env 'base'
justlooks commented 10 years ago

i figure it out ,my salt root is mysaltrepo/salt, so it need point it in master config file gitfs_root: salt