问题标签 [salt-stack]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
salt-stack - 如何检索用户的主目录
假设我有一个服务,它有一个与之关联的支柱配置用户现在我想获取一个 tar.gz 并将它放在这个用户主目录中......我该怎么做......
user.info 返回一堆数据,包括主目录.. 但我怎么才能得到呢?
低
jinja2 - 如何在 SaltStack 中呈现具有特定 .sls 或状态的 minion 的 ID?
我正在使用 SaltStack 来管理一些虚拟机。我正在寻找一种方法来呈现在 top.sls 文件中附加了指定 .sls 的 minion 的 ID/主机名,或在启用 jinja 模板的文件中呈现特定状态的方法。我想这样做的原因是我可以轻松地引用客户端配置中的服务器,而无需在任何地方硬编码值。例如;
/srv/salt/top.sls:
/srv/salt/generic/dns/init.sls:
最后,
/srv/salt/generic/dns/files/resolv.conf:
我具体追求的是等同于{{ list_minions_with_state['bind9'] }}
(我只是为了演示而编造的)。我以为这将是非常普遍需要的东西,但是在搜索模块页面之后,我还没有找到任何东西。
目前,我让客户从支柱获取信息,但这必须手动配置,这感觉不值得花时间。
我希望我可以通过for
循环扩展这个想法,以便在创建服务器时动态添加它们。
编辑:
使用与 top.sls 具有相同数据和层次结构的文件,渲染
给你
我尝试了一些变化,{{ server_id }}
但没有成功。除非有一种简单的方法可以在该函数中使用支柱变量,否则我正在考虑提出一个功能请求并称之为一天。
salt-stack - Salt stack - 解析配置文件时出错:/etc/salt/master
我正在努力学习 Salt。证明很麻烦。甚至无法绕过主配置。下面的行有什么问题?
python - python salt - 评论:没有找到这个奴才的状态
哇……试图瘦盐……我的主……试图按照那里的在线教程。
我在 localhost 上运行 master 和 minion
这是我的错误
这是我的 top.sls
这是我的 ssh/init.sls
所以?什么是交易?
directory-structure - SaltStack: Use directory as source only if it exists
I'd like to know if there's a way of running a SaltStack state only if a directory source is defined in the master.
Basically, I want to allow fo users to put certain configuration files in their HOME
directory. Most of the users won't have anything special, but some of them might (a custom .vimrc
, for instance)
What I'd like to do is execute a file.recurse
for the user's HOME
directory only if that directory exists in master.
As of now, I have the following:
What I want to do is what in the code appears as the ToDo
: If there's a directory salt://users/{{ username }}
in the salt tree (or in the salt master), then execute the file.recurse
with that directory as the source for the file.recurse
. Otherwise, just skip that state and use with whatever default content of $HOME
is has when a user is created (just do nothing, I mean).
I thought adding an onlyif
clause to the file.recurse
configuration (something like - onlyif: test -e salt://users/{{ username }}
would help... but nopes... I also tried to create an empty directory in salt://users/empty_dir/
and pass it as a default (as described here for a file.managed), but that trick doesn't work with file.recurse
(at least not yet):
Thank you in advance.
python - mongodb查询数据,其中键是变量并使用python聚合结果
我目前正在使用使用 mongodb 返回器的 saltstack 实现,并且我正在尝试查询存储在其中的结果以用于报告目的。不幸的是,返回者将信息写入数据库的方式如下所示:
db.hostname21.find({"20140421035007474763" : {$exists : 1}}, {_id: 0}).pretty()
正如您在此处看到的,密钥不断变化,而不是拥有一个标识每个脚本的密钥。但是,我发现故障的格式非常一致,除了它们没有任何键来标识它是故障,只是一个字符串数组:
所以最终我想要做的是能够通过识别工作、主机和失败的性质以及随着时间的推移成功和失败的总数来报告每个失败。如果您注意到每个主机(minion)都创建了自己的集合。所以我有一个 python 脚本,它将遍历集合以确定作业是否在该主机上实际执行:
但我正在努力查询结果以实际确定它是否成功。通过能够提取返回的文档元素以读取每个文档的结果。
如果有人对我如何始终如一地查询键不断变化的结果以获得真正有用的结果有任何建议。
debian - 关于 salt-minion 的弃用警告
我在两台 Debian 机器(Debian 8 - Jessy)上有一个 salt-master(0.17.5)和一个 salt-minion(0.17.5)。
当我启动这个命令salt '*' cp.get_file salt://file /file
时,我的 salt-minion 上有这个警告:
[WARNING] /usr/lib/.../minion.py:594: Deprecation Warning: Master pub message signing is disabled but we received a signature for this message. Most likely this means that your masters and minions are not the same version...
为什么我有这个警告?
salt-stack - Salt-Stack 确实手表暗示需要
我们有以下盐状态,手表是否暗示需要?或者规则最好这样写?
django - 有没有办法看到盐状态转换为正在运行的实际命令?
我有一个像
文档并没有具体说明这究竟是做什么的,尽管它确实似乎确实符合我的预期,这意味着django-admin.py syncdb --settings=mvod.dev_settings --migrate
从目录中运行命令/home/vagrant/virtualenv
。
它实际上无法做到这一点,因为/home/vagrant/virtualenv/
路径实际上需要设置为/home/vagrant/virtualenv/bin/django-admin.py
.
但是,我在没有安装 django 的环境中运行它,所以我希望它会失败。然而,状态返回Result: True
,但输出是这样的Is a directory
我最终发现我必须替换这条线bin_env: /home/vagrant/virtualenv/
,bin_env: /home/vagrant/virtualenv/bin/django-admin.py
因为这就是我想要调用的。
底线:如果我有办法将状态转换为正在执行的确切命令,我会很快弄清楚。
那么有没有办法真正快速地做到这一点?
salt-stack - 如何在盐状态中重新启动?
(这是我在 salt-users 组 FWIW 上提出的问题的副本)
我需要编写一个状态来安装一些 Windows 服务器功能,重新启动 minion,然后安装更多软件。似乎所有部分都在那里(cmd.wait,system.reboot),但我无法连接这些点。
例如,我有一个“网络服务器”状态,应该在机器上安装 IIS。它需要启用一些服务器功能,重新启动(因为 Windows),然后继续。我们使用一个名为“website”的自定义模块来完成此操作,它可以让我安装一个网站,以及另一个用于安装应用程序池的模块。我们的状态文件看起来像这样:
上面的效果很好,除了我们需要在“serverstate.webserver”和“apppool.static”要求之间重新启动。就目前而言,状态失败,我们手动重新启动,然后重新运行状态并且它可以工作。自然,我们想省略手动重启步骤。
是否有解决此类问题的通用模式?