英文:
Use salt-local with `--file-root`, but include also your formula directory?
问题
我执行以下操作:salt-call --local --file-root="$(git rev-parse --show-toplevel)" --file-root="$(git rev-parse --show-toplevel)/formulas/firewalld-formula" --pillar-root="$(git rev-parse --show-toplevel)/pillar" state.test firewalld
。
这对于仅调用firewalld
状态的firewalld-formula
目录是有效的。但原始的根目录被覆盖,因此原始根目录中包含的其他状态不再被找到。是否有一种定义多个根目录条目的方法?手册似乎只谈到了单个路径。
--file-root=FILE_ROOT
设置此目录为基本文件根目录。
将所有内容放在同一个命令开关中会使Salt完全不知道状态文件的位置。因此,这也不起作用:--file-root="$(git rev-parse --show-toplevel) $(git rev-parse --show-toplevel)/formulas/firewalld-formula"
。
在Salt主机上,我可以定义多个文件根目录:
file_roots:
base:
- /salt/srv
- /salt/srv/formulas/firewalld-formula
如何为salt-local
命令创建类似的设置呢?
英文:
I do the following: salt-call --local --file-root="$(git rev-parse --show-toplevel)" --file-root="$(git rev-parse --show-toplevel)/formulas/firewalld-formula" --pillar-root="$(git rev-parse --show-toplevel)/pillar" state.test firewalld
This works fine for just the firewalld-formula directory to call the firewalld
state. But the original root file is overwritten, so other states that were included in the original root are not found anymore. Is there a way to define multiple root entries? The man page seems to talk about a single path.
> --file-root=FILE_ROOT
> Set this directory as the base file root.
Putting everything in the same command switch makes Salt completely lost on where the state files are. So this doesn't work either --file-root="$(git rev-parse --show-toplevel) $(git rev-parse --show-toplevel)/formulas/firewalld-formula"
.
On the Salt master I can define multiple file roots:
file_roots:
base:
- /salt/srv
- /salt/srv/formulas/firewalld-formula
How could I create a similar setup for the salt-local
command?
答案1
得分: 1
salt-call
无法定义多个根目录。有一个开放的功能请求。
请注意,您提出的结构也存在严重的安全问题。您已将您的 pillar 嵌套在您的状态树中。如果在 salt-master 上使用,这将使秘密信息对每个 minion 都可见。
英文:
salt-call
cannot define multiple roots. There is an open feature request.
Note that your proposed structure also has a major security issue. You have nested your pillar inside your state tree. This exposes the secrets to every minion if this were used on a salt-master.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论