salt-stack

How can I aggregate SaltStack command results?

扶醉桌前 提交于 2021-02-19 02:30:34
问题 Is it possible to run a SaltStack command that, say, looks to see if a process is running on a machine, and aggregate the results of running that command on multiple minions? Essentially, I'd like to see all the results that are returned from the minions displayed in something like an ASCII table. Is it possible to have an uber-result formatter that waits for all the results to come back, then applies the format? Perhaps there's another approach? 回答1: If you want to do this entirely within

How can I aggregate SaltStack command results?

我的未来我决定 提交于 2021-02-19 02:29:02
问题 Is it possible to run a SaltStack command that, say, looks to see if a process is running on a machine, and aggregate the results of running that command on multiple minions? Essentially, I'd like to see all the results that are returned from the minions displayed in something like an ASCII table. Is it possible to have an uber-result formatter that waits for all the results to come back, then applies the format? Perhaps there's another approach? 回答1: If you want to do this entirely within

How does Python's types.FunctionType create dynamic Functions?

不打扰是莪最后的温柔 提交于 2021-02-18 07:32:27
问题 I'm trying to strengthen my Python skills, and I came across Open-Source code for Saltstack that is using types.FunctionType, and I don't understand what's going on. salt.cloud.clouds.cloudstack.py Function create() has the following bit of code: kwargs = { 'name': vm_['name'], 'image': get_image(conn, vm_), 'size': get_size(conn, vm_), 'location': get_location(conn, vm_), } The function get_image, and get_size are passed to a function 'namespaced_function' as so: get_size = namespaced

How does Python's types.FunctionType create dynamic Functions?

走远了吗. 提交于 2021-02-18 07:32:11
问题 I'm trying to strengthen my Python skills, and I came across Open-Source code for Saltstack that is using types.FunctionType, and I don't understand what's going on. salt.cloud.clouds.cloudstack.py Function create() has the following bit of code: kwargs = { 'name': vm_['name'], 'image': get_image(conn, vm_), 'size': get_size(conn, vm_), 'location': get_location(conn, vm_), } The function get_image, and get_size are passed to a function 'namespaced_function' as so: get_size = namespaced

SaltStack: conditional include: Error if empty

江枫思渺然 提交于 2021-02-04 21:01:50
问题 I have a conditional include which looks like this: include: {% if CONDITION-A %} - foo.bar {% endif %} {% if CONDITION-B %} - blu.bla {% endif %} This works in most cases. But it fails if CONDITION-A and CONDITION-B are false. How to handle this? 回答1: I use this pattern now: include: - dummy {% if CONDITION-A %} - foo.bar {% endif %} {% if CONDITION-B %} - blu.bla {% endif %} dummy.sls: dummy-no-op: test.nop Not nice, but works. Better (simpler, more obvious) answers are welcome. Docs for

Jenkins configurations gets reverted by SYSTEM user anomaly

狂风中的少年 提交于 2021-01-21 10:02:08
问题 I am running Jenkins version 2.85 on Kubernetes as pod(Affinity set to one workernode). I am creating Jobs using Salt Jenkins module by passing XML to this module. I am using Jenkins Global Library for preforming job execution. My Job config looks like this I am calling GobalLibrary with my parameters like repoURL, componet etc.., Things goes well for weeks and now I landed to a weird situation where my job configurations(config.xml) gets updated/revert automatically. Intermittently my "Build

How to use logic operators in jinja template on salt-stack (AND, OR)

廉价感情. 提交于 2020-12-30 05:01:59
问题 I am using a jinja template to generate a state file for salt. I added some conditionals and would like to express: if A or B . However, it seems I cannot get any logical operator working. It doesn't like ||, |, && (which I understand doesn't apply here), but also not and, or and not even grouping with () , which should be working according to the jinja documentation. I couldn't find any information on this in the salt docs, but I feel I must be making some stupid mistake? My code: {% if

How to use logic operators in jinja template on salt-stack (AND, OR)

£可爱£侵袭症+ 提交于 2020-12-30 04:59:25
问题 I am using a jinja template to generate a state file for salt. I added some conditionals and would like to express: if A or B . However, it seems I cannot get any logical operator working. It doesn't like ||, |, && (which I understand doesn't apply here), but also not and, or and not even grouping with () , which should be working according to the jinja documentation. I couldn't find any information on this in the salt docs, but I feel I must be making some stupid mistake? My code: {% if

Using the output of salt to be used as input for an SLS state or pillar?

寵の児 提交于 2020-01-04 11:09:32
问题 For example, I want to find all nodes with a certain tag, grab their IP address, then generate a config file to distribute to those nodes. A use case might be a database that needs to know about every other node, but can have nodes added and removed at any time. 回答1: You can use Salt Mine to do it. First, distribute this configuration to all the Minions: mine_functions: grains.item: - roles - fqdn_ip4 With that configuration, every Minion will publish those two grains to all other minions.