我正在尝试使用salt-ssh
将我的salt master中的文件复制到minon
使用file.managed
模块。但它给出了以下错误...
[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
来自/etc/salt/master
file_roots:
base:
- /srv/salt
[盐] #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 :(得分:0)
我注意到,如果我将文件复制到copy.sls退出的同一目录中,即在我的情况下/srv/salt
,那么它就可以了。
# cat copy.sls
add script:
file.managed:
- name: /opt/testSalt
- source: salt://testSalt
- user: root
- mode: 644
salt-ssh' *' state.sls copy
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