Questions tagged [saltstack]

SaltStack is an open source configuration management and remote execution application.

0
votes
0answers
21 views

Unable to run sync_grains while using grain matching

Whenever I try to run the sync_grains command on a host using glob matching, it works great: root@salt:~# salt '*-stage-*' saltutil.sync_grains; echo $? i-0bbaf106121397b74-stage-knowledge-base: 0 ...
0
votes
2answers
27 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 ...
1
vote
1answer
60 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
0answers
65 views

Passing a variable into Salt cmd.script module?

I have a PowerShell script that finds what version of Java is installed by checking the registry but the script has Java hard coded into it and I would like to be able to change it to Adobe, or Google ...
0
votes
1answer
11 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
1answer
22 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
2answers
29 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
1answer
23 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
1answer
55 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
0answers
41 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 %} {%- ...
0
votes
1answer
41 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
1answer
115 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
2answers
87 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
1answer
44 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/...
1
vote
2answers
814 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
1answer
93 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 ...
0
votes
0answers
37 views

SaltStack: Requisite not found

I try to configure sqreen. I installed the pkg, sqreen-repo: cmd.run: - name: curl -s {{ sqreenScriptUrl }} | sudo bash - unless: test -f /etc/apt/sources.list.d/sqreen_sqreen.list - ...
1
vote
1answer
158 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
1answer
178 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/...
0
votes
2answers
97 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
1answer
22 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 ...
1
vote
1answer
52 views

Deliver unique file for each Salt minion

There is some directory path, like /etc/opt/mysoft which contents should be different for each minion. So for minion A it contains config.ini with come contents and for minion B it contains config....
1
vote
2answers
222 views

Executing arbitrary sls file with salt

I'm learning about salt. I understand that the way things work, state files must be put under a root directory specified statically in the master/minion config. So my question is, is there a way to ...
0
votes
1answer
50 views

SaltStack: Disable Cron during run

I would like to disable cron on the minion when salt gets executed. Disabling it would be easy: service.disabled But how to enable it again (in all cases (success or error))? What I want is ...
1
vote
0answers
286 views

GitFS Salt Environments with a single top.sls

The documentation states that if you use salt_top_saltenv: base in the master config, that I can force all Minions to only use the base saltenv for the top file, ignoring all other top files, is ...
0
votes
0answers
66 views

clone VM via SaltStack

I try to clone the virtual machine: ubuntu-template: provider: vcenter01 clonefrom: Ununtu1804 host: 192.168.1.6 and got: Error creating newvm1: A specified parameter was not correct: ...
0
votes
0answers
40 views

Salt: Better error message if pre-condition failed

If this condition is true: ~postgres/data/postgres.conf exists and ~postgres/data/base/ does not exist then I want to write out an error message. I call above a "pre-condition" check. This state ...
2
votes
0answers
108 views

How can I set user/group ownership on a SaltStack git clone?

I have a hand-maintained Bugzilla installation that I'm trying to move to being managed with SaltStack. Currently I have the following .sls file to set up the clone: https://github.com/bugzilla/...
1
vote
1answer
693 views

How to reposync saltstack? reposync failing with error message `Removing […], due to missing GPG key.`

On a RHEL 7.4 system, I add the salt-latest repo as follows: yum -y install https://repo.saltstack.com/yum/redhat/salt-repo-latest-2.el7.noarch.rpm Notice, amongst other things, this creates the ...
1
vote
1answer
258 views

SaltStack: How to create user and a directory in his HOME directory?

I want to create a user and a directory in his HOME directory. Unfortunately the HOME directory is not allways directly under /home. On some minions it is under /localhome and some use /users/.
1
vote
1answer
515 views

Saltstack and Python3 issue

I'm having a bit of an issue with the following recipe: setup-compose: file.managed: - source: https://github.com/docker/compose/releases/download/1.21.1/docker-compose-Linux-{{ grains['cpuarch'...
0
votes
1answer
84 views

salt-ssh Do changes which spans several hosts

I need to change two hosts: A new web-server gets configured A tunnel between tunnel-host and the new web-server should get created We implemented both, and both steps work: root@s# salt-ssh ...
0
votes
0answers
51 views

SaltStack: --failhard for salt-ssh

I would like the execution of salt-ssh to cancel on the first error. I read this: https://docs.saltstack.com/en/latest/ref/states/failhard.html But I am using salt master-less with salt-ssh. Is ...
0
votes
1answer
342 views

SaltStack: ImportError: No module named backports.ssl_match_hostname

I get this exception: ===> salt-ssh remote-host cmd.run 'id' remote-host: ---------- retcode: 0 stderr: Traceback (most recent call last): File "/var/tmp/....
0
votes
1answer
123 views

Salt modules in state file

salt.modules.iptables is great to use from command line but how can I use this in a state file. First I want to check if iptables is running: check_process: cmd.run: - name: ps aux | grep '...
0
votes
1answer
331 views

SaltStack: Stop on first error

I have a sls file for SaltStack which looks like this: etckeeper: pkg.installed etckeeper_extra_packages: pkg.installed: - pkgs: - hwinfo {%- if not salt['file.directory_exists' ]('/...
0
votes
2answers
81 views

SaltStack: Do “etckeeper init” if /etc/.git is not there

I want to deploy the tool etckeeper via SaltStack. Installating the RPM/DPKG is easy. Next step is to call etckeeper init after the installation. My current idea is this pseudo-code: execute ...
0
votes
1answer
90 views

How do I use debconf in salt with pillars?

I have the following: newrelic-debconf: debconf.set: - name: newrelic-php5 - data: 'newrelic-php5/application-name': { 'type': 'string', 'value': '{{ salt['pillar.get']('newrelic:...
3
votes
2answers
3k views

SaltStack: Execute `systemctl --system daemon-reload` if service file was changed

We deploy and change system service files via SaltStack. For example, if file /etc/systemd/system/superfoo.service gets changed, then systemd emits this warning: Warning: Unit file of superfoo....
0
votes
0answers
41 views

SaltStack: Reason why postgres_user.absent fails?

The Salt state postgres_user.absent fails: ID: remove_foobar_vums_dci__database_user Function: postgres_user.absent Name: foobar_vums_dci Result: False Comment: User foobar_vums_dci ...
2
votes
0answers
113 views

Saltstack: how to configure a state that need a service running then restart this service

I try to configure a software, by sending a command to its running service. However, to apply the new configuration, the service needs to be restarted. How can I do that? I tried: appsrv: service....
2
votes
0answers
125 views

salt pkg.upgrade misses some updates

If I execute apt upgrade several packages will be found: # apt upgrade The following NEW packages will be installed: linux-headers-4.4.0-109 linux-headers-4.4.0-109-generic linux-image-4.4.0-109-...
1
vote
1answer
378 views

SaltStack: How to remove a block which was created with file.blockreplace?

I use file.blockreplace like this: etc_sudoers_{{ system_name }}: file.blockreplace: - name: /etc/sudoers - marker_start: "# START etc_sudoers_{{ system_name }} -DO-NOT-EDIT-" - ...
1
vote
1answer
82 views

Saltstack - need to get some info from a minion scheduled event

I've got a minion scheduled event (/etc/salt/minion.d/_schedule.conf) which runs a particular state file using the state.sls function. I've got jid_include and return_job set to "true". I know the ...
1
vote
0answers
44 views

Any way to run a vim session over salt-ssh?

Anyone know of a way to interact with the console/terminal over a salt-ssh command? I'm trying to run vim to change the subnet and FQDN for about 70 hosts. I could use sed and company but wondering if ...
3
votes
1answer
186 views

Storing saltstack server configs in version control

I currently have a few servers that are managed by saltstack, every now and then saltstack fails to deploy the new configs because of an issue somewhere and it can take a while to work out what ...
0
votes
1answer
210 views

Using salt-ssh for Ubuntu/Debian patching (dialog frontend is not usable)

I'm looking into replacing a Linux based home-grown patch management solution with salt-ssh. The current system uses a shell script to iterate through a list of hosts and copies a script named apt-...
1
vote
1answer
1k views

How can I get salt-ssh to run a local script on a remote node?

.::UPDATE-SOLVED::. With must assistance form @wirap, it is now working. I've symlinked the script directory into /etc/salt/states/scripts and using this test.sls configuration it is now working. /...
1
vote
1answer
415 views

Managing IPtables efficiently with Saltstack

I'm trying to configure a flexible iptables management solution with SaltStack, but I find it harder than I thought it would be. My main requirement: to be able to have a pillar where I keep a list ...
1
vote
2answers
82 views

SaltStack: Push single change, not all

I have a server which was managed by hand before. We want to manage this server with saltstack in the future. I run this to see what you current salt formular would do: salt-ssh remote-host state....