我想知道在/ etc/salt/master中聲明環境的效用是什麼?瞭解鹽環境
實施例:
file_roots:
base:
- /srv/salt
env1:
- /srv/salt/env1
這是/ SRV /鹽樹:
.
├── base
├── env1
│ └── domain1
│ ├── init.sls
│ └── nginx.conf
└── top.sls
而top.sls:
env1:
'*':
- env1.domain1
這裏面的ENV1 init.sls/domain1/
/etc/nginx/nginx.conf:
file.managed:
- source: salt://env1/domain1/nginx.conf
當執行:
salt '*' state.sls env1.domain1
一切工作正常。
但隨着highstate:
# salt '*' state.highstate
myHost:
Data failed to compile:
----------
No matching sls found for 'env1.domain1' in env 'env1'
鑑於環境 「ENV1」 在主config.I聲明改變了我的配置,我已經把:的
- source: salt://domain1/nginx.conf
代替:
- source: salt://env1/domain1/nginx.conf
我有這個錯誤:
Comment: Source file salt://domain1/nginx.conf not found
是否有配置錯誤的地方? 什麼是宣佈在主人的conf環境的效用, 如果我們不能把它直接使用salt://subfolder
,而不是直接salt://environment/subfolder
?
我無法找到有關創建環境和使用它們的好文檔!
===編輯===
這是新的配置:
主:
file_roots:
base:
- /srv/salt/base
env1:
- /srv/salt/env1
的/ SRV /鹽樹
.
├── base
│ └── init.sls
├── conf_template
├── env1
│ └── domain1
│ ├── init.sls
│ └── nginx.conf
└── top.sls
top.sls:
base:
'*':
- init
env1:
'*':
- domain1
而ENV1 /域1 /初始化。SLS:
/etc/nginx/nginx.conf:
file.managed:
- source: salt://domain1/nginx.conf
和執行結果:
salt '*' state.sls env1.domain1
myHost:
Data failed to compile:
----------
No matching sls found for 'env1.domain1' in env 'base'
這個github問題(評論對話框)幫助我解決了這個問題:https://github.com/saltstack/salt/issues/10447 – 2015-11-05 21:08:03