2017-09-05 36 views
0

我試圖使用salt-sshfile.managed模塊將文件從我的salt主文件複製到minon。但它是從/etc/salt/master給下面的錯誤...slat-ssh在env'base'中找不到與'copy.sls'匹配的sls

[salt]# pwd 
/srv/salt 
[salt]# ls -l 
total 20 
-rw-r--r-- 1 root root 80 Sep 4 21:37 copy.sls 
-rw-r--r-- 1 root root 47 Sep 3 04:52 lftp_install.sls 
-rw-r--r-- 1 root root 44 Sep 3 04:52 lftp_remove.sls 
-rw-r--r-- 1 root root 124 Sep 3 04:50 lftp.sls 
-rw-r--r-- 1 root root 65 Sep 3 04:53 Service_check.sls 
[salt]# cat copy.sls 
add script: 
    file.managed: 
    - name: testSalt 
    - source: /root/testSalt 
    - dest: /tmp/testSalt 

file_roots: 
    base: 
    - /srv/salt 

[鹽]#鹽-SSH 'KK' state.apply copy.sls

KK: 
    - No matching sls found for 'copy.sls' in env 'base' 


When i ran this into the debug mode, it gives as follows.. 

[DEBUG ] Could not find file from saltenv 'base', 'salt://copy/sls.sls' 
[DEBUG ] Could not find file from saltenv 'base', 'salt://copy/sls/init.sls' 
[DEBUG ] LazyLoaded nested.output 
KK: 
    - No matching sls found for 'copy.sls' in env 'base' 
+0

始終使用YAML皮棉檢查,以驗證沒有標籤和空間上的縮進的組合。在遇到不正確的yaml語法時,Saltstack並不總是顯示正確的異常錯誤。 – mootmoot

+0

我檢查了一下,我沒有看到任何縮進或標籤空間! – rockypy17

+0

嘿,你的top.sls在哪裏? – mootmoot

回答

0

我注意到,如果我將該文件複製到copy.sls退出的同一個目錄中,即在我的情況下爲/srv/salt然後它工作。

# cat copy.sls 
add script: 
    file.managed: 
    - name: /opt/testSalt 
    - source: salt://testSalt 
    - user: root 
    - mode: 644 

鹽-SSH '*' state.sls複製

KK: 
---------- 
      ID: add script 
    Function: file.managed 
     Name: /opt/testSalt 
     Result: True 
    Comment: File /opt/testSalt updated 
    Started: 07:19:44.332582 
    Duration: 20.366 ms 
    Changes: 
       ---------- 
       diff: 
        --- 
        +++ 
        @@ -1,1 +1,2 @@ 
        salt copy test 
        +second commit 

Summary 
------------ 
Succeeded: 1 (changed=1) 
Failed: 0 
------------ 
Total states run:  1