Questions tagged [salt]
Salt is a Python-based open-source configuration management software and remote execution engine.
40
questions
2
votes
2
answers
105
views
Set umask for an individual salt state
Is there a way to set the umask for the pip state module or is there a more generic way to set the umask before specific state modules are run? In ansible the pip module takes a umask parameter. I do ...
1
vote
1
answer
88
views
How does one perform systems testing against multiple interdependent machines?
I'm looking for a platform that allows me to run tests against multiple, closely-coupled systems. We deploy different products to Red Hat family machines - think Rocky Linux, CentOS, Fedora, RHEL, etc....
1
vote
1
answer
205
views
How can I pass a secret from a Salt Master to a Minion without using a Pillar?
I am looking to understand how I can reduce duplication of secrets. For example SSL Certificates. I want to have the Salt Master pull the Certificate from a Secure Source (Azure Key Vault) and then '...
0
votes
1
answer
1k
views
Salt - Need state to check pillar and perform a if/else check
This is salt 101 I think, but I'm really a salt N00b and need assistance.
I need to disable specific services on all of our servers by default, but I need to create a pillar that allows me to override ...
1
vote
2
answers
125
views
Saltstack howto create a Concatenation CA?
I would like to have the following a bit more clean. I'm trying to create concatenated CA file using Salt.
To accomplish this I first have to collect all glusterfs.pem files from all my minions and ...
2
votes
1
answer
547
views
Jinja syntax error: missing endif, in spite of providing it
I am using Salt 2019.2.0 version and below is my state file where I am using if condition to check the values and run states if it's a match. Even if I have provided endif, it says Jinja looking for ...
2
votes
3
answers
524
views
Ansible event driven capacity
I've been using SaltStack a lot in my previous job, and loved its event driven model. Now, in my new job, we are using Ansible, and definitely not in an event driven model.
I was wondering if there ...
0
votes
1
answer
144
views
gitlab -ci script not being updated on runner
I have a problem I can't get my head around in gitlab-ci: I have a monorepo where I store some infra code (IaC), in this repo I have a script which allow me to lint the saltstack states code, as :
#!/...
1
vote
1
answer
53
views
Why is IF failing with satl state file from Jenkins?
I invoke a saltstack state file "init.sls" from a Jenkins pipeline as below. If job == Yes, it is expected to execute test_command and test_final, else if job == No, it must execute test2_command and ...
1
vote
1
answer
395
views
How to assign saltstack pillar values from Jenkins comma separated input parameters?
I have a Jenkins job with string parameter as target "server1,server2". Jenkins pipeline script is expected to execute the job on server1 and server2 respectively.
There is a common salt sls file that ...
1
vote
1
answer
2k
views
Saltstack Jinja template pillar merge
I have a several pillars and I am trying to merge them in the same jinja variable
{%- import_yaml "server_list_de.yaml" as servers %}
{%- import_yaml "server_list_uk.yaml" as servers_uk %}
{%- ...
1
vote
1
answer
120
views
How to add multiple jvm options in a saltstack jinja?
I have a config.jinja file with below jvm options:
`-Dappdynamics.agent.appName=AP_{{ pillar['region'] }}`
However the AP_{{ pillar['region'] }} varies for different environments. For Dev/Prod it ...
1
vote
0
answers
429
views
How to match a pattern and replace all files in a directory using salt states? [closed]
Salt stack state to recursively loop over a directory without explicitly specifying file names.
Added single and multiple quotes, that didn't help. I don't wish to specify each file for a file replace....
1
vote
1
answer
2k
views
SaltStack states pattern and replace for multiple files under directory and for multiple line matches
I am using saltstack state pattern and replace to match a pattern and replace with a new pattern. My init.sls file executes below:
`modify_script.sh:
file.replace:
- name: /path/to/script.sh
...
1
vote
0
answers
165
views
Pass Variable in pipeline script [closed]
I am trying to pass a variable input to "credentialsId: $creds" from SiteID but unable to. I tried multiple expressions in pipeline script with quotes etc and none worked. I am learning and need ...
4
votes
2
answers
25k
views
Jenkins Groovy to parse console output and mark build failure
What would be a Groovy or pipeline step to parse Jenkins console output, identify a string and mark the build as failure if the string is matched?
4
votes
1
answer
254
views
What is a glob in salt-stack?
I was going through targeting minions in salt. There I came across a term called glob. Can someone explain with an example what is a glob in Salt-Stack?
3
votes
1
answer
311
views
Where are dunder dictionaries stored in salt?
I am new to Salt-Stack wanted to know where are all the dunder dictionaries stored?
For example __salt__, __opts__, __grains__, __beacons__).
1
vote
1
answer
204
views
How to create AWS application load balancer using saltstack
I was trying to create application load balancer with salt stack. I am using salt boto_elbv2 which is having option to create target groups but dont have option to create load balancer, how can i ...
5
votes
1
answer
137
views
Why unable to find the exact path for grains storage in master?
I am trying to completely remove the grains from the system. I have one master and one minion setup(minion id= minion1). I am doing
salt minion1 grains.ls
that is listing me all the grains
Now I ...
4
votes
4
answers
2k
views
Yaml linting failling when jinja is used
I am using https://yamllint.readthedocs.io/en/stable/index.html to lint my yaml files (used in a saltstack context, and linted by jenkins jobs at every commit), but as reported and explained here, it ...
1
vote
1
answer
196
views
saltstack: archive.extracted template jinja
I have an archive on my master and want to extract it on the minion. For this it is fine I use :
archive.extracted:
- name: 'c:\PACKAGE'
- source: salt://myfile.zip
- archive_format: ...
1
vote
1
answer
457
views
salt-stack: capture group for regex include_pat [closed]
is it possible to have a capture group with include_pat when copying files ?
I would like to do something like that:
copy_template:
file.recurse:
- name: '{{ service_path }}\$1'
- ...
1
vote
0
answers
34
views
Ensure that reactor worked out and see the result of execution state in SaltStack [closed]
Is there a way to get a progress of working out of saltstack reactor in realtime via API after sending event to reactor via API request?
For now, the single output which is possible to see is {"...
2
votes
1
answer
232
views
SaltStack Reactor fails with exception
I have the next conf files for salt reactor:
reactor.conf
'salt/netapi/hook/cd':
/srv/reactor/dev.sls
dev.sls
# vim: sts=2 ts=2 sw=2 et ai
{% set payload = data.get('post') %}...
1
vote
1
answer
52
views
Salt State is running against all servers except one, why?
I recently asked a question here: Is it possible to use multiple if statements in a salt state?
Thanks to the answer I have managed to update my state to only check specific files exist on specific ...
2
votes
1
answer
7k
views
Is it possible to use multiple if statements in a salt state?
I have a Salt state which checks multiple files exist on our webservers, we have 4 webservers and 2 environments so a combined total of 8. This state is applied to all by using a grain 'webserver'.
...
6
votes
1
answer
4k
views
Check a process is running with Salt Stack?
Is it possible to check if a specific process is running via a Salt State? Looking through Salt Stack documentation and scouring forums I haven't found any way of simply checking if a service is ...
2
votes
1
answer
1k
views
Is it possible to use a list with 'file.exists' in Salt?
I asked a question recently regarding the most efficient and scalable way to check which files/services exist in multiple environments. Thanks to an answer I have successfully set up roles for all of ...
1
vote
1
answer
571
views
Best method of retrieving environment information via Salt Stack?
I have been tasked with using Salt Stack to find out what files/services exist in each of our environments (Test, UAT, Production).
The Salt master can speak to all servers in Test and UAT (...
2
votes
1
answer
399
views
SaltStack: Use Temporary Scripts And Not Cause State Changes To Reported
I am doing some operations with Kafka via salt, and using scripts to perform them.
My current SLS file looks roughly like:
/tmp/script.sh:
file.managed:
- source: salt://blah/blah
Run script:
...
4
votes
1
answer
190
views
Salt Stack Reporting - Executing commands based on environment
Salt allows users to assign machines to environments by setting in /etc/salt/minion:
environment: example
You can then execute environments for that state with the command salt '*' state.apply ...
5
votes
1
answer
3k
views
Securely grab minion ID in pillar top file template?
I found this SLS file in a pillar top.sls targeting example:
top.sls:
base:
'*':
- hostspecificsls
hostspecificsls:
# See https://groups.google.com/forum/#!topic/salt-users/UWfP6bMe6F8
{% ...
4
votes
1
answer
1k
views
Salt Stack environments ignoring saltenv
I have a salt master with four environments configured (base, dev, staging, prod)
I am initially trying to set a pillar item to track which envrionment is in use, namely core:env
However when I ...
3
votes
1
answer
101
views
SaltStack and Vagrant adding files
I use file.managed to add a file:
/home/vagrant/.bash_profile:
file.append:
- name: /home/vagrant/.bash_profile
- source: salt://config/user/.bash_profile
- user: vagrant
- group: ...
4
votes
1
answer
2k
views
How can I share a (global) variable between salt states?
I am using Salt for deployment and configuration management. In order to attach to a FreeIPA server, I need to randomly generate an OTP token and then use it to attach to IPA. How can I share a ...
25
votes
2
answers
15k
views
How to examine Jinja output in Saltstack?
I have a templated SLS in Salt I'm trying to build, but it's emitting invalid syntax, which is resulting in errors such as:
my-minion-id:
- State 'system' in SLS 'network' is not formed as a list
...
3
votes
1
answer
779
views
How to insert a minion Powershell variable into Salt Pillar or Mine?
Say I have a Powershell script, named test.ps1, that has this:
$VariableForPillar = 5
I can call it from a Salt state with -
test powershell run:
cmd.run:
- name: 'C:\Windows\System32\...
4
votes
1
answer
48
views
Using requisite injection to order states
Given three states, /root/a, /root/b and /root/c, I want /root/c to execute before /root/b, and /root/b to execute before /root/a.
Given a Salt SLS file salt://ordertest/init.sls:
/root/a:
file....
7
votes
2
answers
1k
views
Constructing Dependencies from a Pillar in Saltstack
I'm trying to create a dummy state in Salt to pull dependencies from a list derived from a pillar.
In my top.sls file, I have:
base:
'*':
- components
Then, in components.sls, I have:
{% if '...