Questions tagged [saltstack]
The Salt Project, previously known as SaltStack, is a Python-based open-source configuration management software and remote execution engine.
285
questions
0
votes
1
answer
132
views
using salt to upgrade Linux Mint OS
[Note: I originally posted this question on StackOverflow, but it was deleted because it was judged as off-topic. I am trying again here. For the record, there was an answer supplied, which I have ...
0
votes
1
answer
1k
views
Salt Jinja Template concatenate strings with Looping
I am having issues concatenating strings in Salt, I want to grab a salt grain called "accesslist" which holds an array of groups to append to an access list.
{% set access_filter = '(...
0
votes
0
answers
85
views
How to avoid specific folders in recursive for salt files
Need to skip a folder in salt file and have never worked with these before. Have the following folder structure on my system
/Test
/A
/B
/C
Salt state file shows the instructions as:
...
1
vote
1
answer
98
views
SaltStack if condition failed mapping values while running command
I'm trying to echo a line into sudoers file like so but I can't figure out the correct syntax it's wanting for that specific command.
gwconfig:
cmd.run:
{% if grains['ip4_gw'] == '192.168.1.1' %}...
1
vote
0
answers
463
views
Can't register the minion on salt-master
I'm trying to connect salt-minion to the Salt master. But it doesn't work. Where is the mistake
what is wrong?
ping from Master server to minion server works and vice versa too
here are the logs:
**
...
0
votes
1
answer
60
views
time out when using reactor (salt)
I have some troubles with setting up reactor in salt.
Here is my configuration:
reactor:
- 'salt/minion/*/start':
- /srv/reactor/start.sls
and my /src/reactor/start.tls:
{% set minion_id = data[...
1
vote
1
answer
95
views
Is it possible to store custom runner output to pillar data in SALTSTACK?
I have a Salt formula that runs on my minions, and it runs a custom module that reaches out to the web for some JSON data for the latest version of chrome. It works great, but I thought it would be ...
0
votes
1
answer
157
views
How to access a roles hostlist in a statefile?
I am using salt by defining roles which map a list of states to a list of hosts on which to apply the states:
#/srv/pillar/base/top.sls:
{% set h = 'host1, host2,' %}
'L@{{ h }}':
- roles.Servers
...
1
vote
1
answer
232
views
Saltstack set java alternative using command instead of path
I am trying to apply a salt.states.alternatives to set my default java to java 11. However, I need to put in the full path for the openjdk, which includes the version number that changes every time ...
1
vote
1
answer
38
views
Set Firmware Option for Vsphere VM created by salt-cloud
I am trying to create a VM hosted in Vsphere using salt-cloud and need to set the boot options for this VM.
From what I can tell there isn't an actual option for this so I guessing it needs to be part ...
1
vote
1
answer
166
views
Auditd - Don't log events from salt-minion
I'm updating our Auditd rules (Red Hat Linux) to log all tty/interactive commands from all users. That part works no problem.
What I'm trying to do now is to exclude commands issued by our salt-...
0
votes
1
answer
428
views
saltstack cmd.run variable expansion
I can get salt to let me run keytool this way:
salt [host] cmd.run shell=powershell '& "$JRE_HOME/bin/keytool.exe" --help'
But I can't figure out how to put this into a state file. A ...
1
vote
1
answer
786
views
Loop through variables in state file and use the vars in the target template as well
In Ansible I can loop through a list of dicts/lists and then use the loop vars in the Ansible task, but also in the template I call on.
I'm trying to do the same in Salt, but it seems like it's not ...
0
votes
1
answer
2k
views
Saltstack - mapping values are not allowed in this context
Following state file throws an error
"Rendering SLS 'base:settings.app.state.sls' failed: mapping values are not allowed in this context"
I rendered the state of the minion into a file and ...
0
votes
1
answer
139
views
How to Pre-seed Salt Minion's Archives
So I am creating a state file to install MatterMost on a minion. So far it looks like this:
mattermost-usergroup:
user.present:
- name: mattermost
- shell: /bin/sh
- createhome: False
...
0
votes
1
answer
441
views
Salt: connection refused to proxy
I have troubles with Salt, installed on an HPC cluster. All maintenance commands (i.e. salt commands) are made from master0. The minions to be managed are named node0, node1, ..., node4. When I try to ...
0
votes
1
answer
995
views
Salt state file doesn't load info from pillar
I'm getting this error when I'm trying to apply my statefile to my minion:
client.school.test:
Data failed to compile:
Rendering SLS 'base:nextcloud2' failed: Jinja variable 'list object' has no ...
0
votes
1
answer
2k
views
No matching sls found for 'state.sls' in env 'web'
i am trying to execute a specific sls file on specific machine using
salt "remote-host" state.apply state.sls
but i am getting error which i dont understant why i am getting this error.
...
0
votes
1
answer
108
views
Salt Cloud Map File to Map Data
I'm trying to deploy a server using Salt cloud and the VMWare provider and I have developed a profile and a map file that works fine. I see however that there is a salt cloud module that might fit my ...
0
votes
0
answers
219
views
Process getting different environment variables to system settings
I have an issue where a tomcat process started through salt stack is getting different environment variables than the ones set on the system. This is on a centos 7 server.
Below is the locale -v ...
0
votes
1
answer
620
views
Salt Pillar: How to use different values for prod / dev?
I'm not sure if I am thinking about this the right way, but here is my Problem:
I want to use the same Salt state and pillar configuration for production, development and test servers. The only ...
0
votes
2
answers
140
views
Using Configuration management tools to synchronize large files
We are looking into using a configuration mangement tool (like Salt or Puppet) to automate what is currently a lot of manual work. One requirement is that we have to distribute rather large files / ...
0
votes
1
answer
204
views
SaltStack: install packages behind proxy
Getting through a Saltstack tutorial and ran into a problem how to install packages on a linux host if it's behind a proxy. For example, I have a file nettools.sls:
install_network_packages:
pkg....
0
votes
2
answers
803
views
Open SSL throwing unknown option '-n' in Amazon Linux2 instance
My code throws error when it reaches this line:
{% set encrypted_password = salt['cmd.run']('openssl enc -aes-128-cbc -a -salt -md md5 -in <(echo -n "' + ssm_plaintext_password +'") -pass pass:'+...
1
vote
1
answer
3k
views
saltstack: Pass jinja variable from a salt state file to an included salt state
I have the case where I have 3 salt states A.sls, B.sls and C.sls of which only one will be applied on a host.
All 3 of them sets a jinja variable x to a specific value and then I want all 3 to call ...
0
votes
1
answer
681
views
Saltstack: Select data from database using salt
I want to select data from a database table (here mysql) with saltstack.
In my test scenario I have a linux host called salt-master. On this host the database, the master and the minion are running.
...
0
votes
1
answer
447
views
Can ext_pillar be configured depending on pillarenv or saltenv?
I'm looking for a way to select the external pillar depending on saltenv or pillarenv variable.
From saltstack documentation, ext_pillar does not support the same syntax as pillar_roots (https://docs....
1
vote
1
answer
360
views
Salt configuration for nftables prerouting
I'm trying to configure a nftables-rule for forwarding traffic from my server to a LXC container, however, the way that the salt states module for dport renders the given value is not accepted by ...
1
vote
1
answer
1k
views
SaltStack: Delete directory, if it is empty
How can I delete a directory with SaltStack, if it is empty?
First I remove a file in this directory, and then I would like to delete the directory. But if there is one or several files in the ...
0
votes
2
answers
4k
views
How to install salt for python3?
When I check my salt-minion version, I get the following message:
[root@localhost ~]# salt-minion --version
/usr/lib/python2.7/site-packages/salt/scripts.py:198: DeprecationWarning: Python 2.7 will ...
0
votes
1
answer
591
views
SaltStack: No usable error message if dpkg fails
I get this message from salt-ssh
ID: apache
Function: pkg.installed
Result: False
Comment: Problem encountered installing package(s). Additional info follows:
errors:
...
0
votes
1
answer
144
views
Call state directly via salt-ssh
Is it possible to call this state via salt-ssh directly?
vim:
pkg.installed
I mean without creating an sls file?
0
votes
1
answer
2k
views
Loop through salt pillar to create file without knowing keys
Background: I need to make an XML file like this:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="BaseOU" value="DC=myplace,DC=wan" />
<add key="...
2
votes
2
answers
3k
views
SaltStack: found conflicting ID
My sls file:
/etc/sudoers.d/foo:
file.managed:
- contents: |
foo ALL = NOPASSWD: /usr/bin/systemctl restart minio_storage-foo.service
foo ALL = NOPASSWD: /bin/systemctl restart ...
8
votes
1
answer
13k
views
Unable to generate GPG keys without passphrase on Ubuntu 18.04 [closed]
Has anyone tried creating GPG keys for encrypted pillars on Ubuntu 18.04?
I'm using the following command to attempt to generate the keys:
gpg --gen-key --homedir /etc/salt/gpgkeys
When I run that ...
0
votes
1
answer
256
views
Salt-Stack init process after package is installed
Installing AIDE needs to follow by a init proces.
aide:
pkg:
- installed
Now the following commands need to run only once:
/usr/sbin/aide --config=/etc/aide.conf --init
mv -f /var/lib/aide/aide.db....
0
votes
1
answer
129
views
SaltStack: normalize Package name
I would like to have less conditions in my saltstack sls files.
Up to now it looks like this:
foo_package:
pkg.installed:
- pkgs:
{% if grains.os_family == 'Debian' %}
- foo_BAR
{% ...
0
votes
2
answers
76
views
saltstack equivalent of puppet last_run_summary.yaml
Does Salt have the equivalent of Puppet's last_run_summary.yaml? If not, what's the suggested way to monitor the success or failure of executions on individual salt minions?
0
votes
1
answer
282
views
Saltstack: How to install a new zypper RPM Repo?
How to add a new rpm package repo via saltstack?
I checked the docs, and only see method to list, modify or delete repos:
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.zypper....
0
votes
1
answer
88
views
Saltstack formulas (starter)
Is any saltstack formula 'skeleton' available so it can create a structure as described here?
In chef you have knife cookbook create or in ansible ansible-galaxy init.
0
votes
1
answer
571
views
Salt: Raise Error if file.replace did not find anything to replace
Maybe I am blind, but I could not find a way to let the salt-ssh call fail, if file.replace did not replace a single line.
If the pattern I provide did not match, then I want to get noticed.
Example:...
0
votes
1
answer
1k
views
Jinja "for loop" statement with multiple lines (saltstack)
When using salt for specifying user creation, it is unorganized to have the for statement in a single line. Example:
{% for USR in 'hewey','dewey','loui' %}
Is it possible to break this into ...
0
votes
2
answers
2k
views
Salt: file.replace on a list of files (globbing)
I use file.replace and would like to use this not on a single file, but on a list of files. The list of files comes from globbing.
Example: I want to modify /etc/ImageMagick*/policy.xml.
The file ...
0
votes
1
answer
509
views
Salt: file.replace: ignore_if_missing gets ignored?
I want to enable logging of an fstp server like this: https://serverfault.com/a/74234/90324
But salt does nothing. I reduced it to this:
enable_logging_of_sftp:
file.replace:
- name: /etc/ssh/...
6
votes
3
answers
22k
views
How to copy file from master to minions on salt-stack?
I want to copy a file from salt stack master server to minion servers. I found a script from https://stackoverflow.com/questions/27687886/copy-a-file-from-salt-master-to-minions. But I got an error.
...
0
votes
1
answer
808
views
How to instal vim using salt stack?
I have salt-stack maser and minion servers which running on centos7. I want to install vim package in minion server. For that I have created srv directory and vim.sls file under etc.
My vim.sls file ...
1
vote
1
answer
2k
views
Automatic pillars by host name
I have problem where managing multiple domains in one top.sls file is getting difficult. How could I write top.sls so that it only takes those pillars that match my minion name/hostname.
For example:...
0
votes
1
answer
970
views
Salt Stack file.recurse Recurse Failed
I built a state file in salt to copy a list of check_mk Nagios scripts down to the remote server. Below is a snip of the state file.
check_mk_defined_checks:
file.recurse:
- name: /usr/lib/...
1
vote
2
answers
2k
views
Saltstack state.apply determine whether it is being run in test=True mode ?
We are using serverdensity (BETA MODULE - https://docs.saltstack.com/en/latest/ref/states/all/salt.states.serverdensity_device.html) with salt and have hit the (bug?) where if you try a :
salt '*...
0
votes
1
answer
158
views
.mount a folder from the salt:// share onto a minion?
I'm trying to write a state that will mount the folder currently in the "salt://" directory with the sophos installer, run the installer.sh, then unmount it. I'm hoping to avoid copying the whole ...