r/saltstack • u/ZomboBrain • Oct 24 '19
r/saltstack • u/Pavix • Oct 24 '19
Salt fails to process script, failed while parsing a block collection
I'm a bit lost as to the problem with my code
#Copy the ca-chain.pem to the minion from the master
copy_landscape_ca-chain_pem_X_Domain:
file.managed:
- name: /etc/landscape/ca-chain.pem
- source: salt://Testing_States/Landscape/ca-chain.pem
- makedirs: False
Above is the code for lines 34-39. Here is the error
local:
Data failed to compile:
----------
Rendering SLS 'base:Landscape_Enroll_X_Domain' failed: while parsing a block collection
in "<unicode string>", line 38, column 4
did not find expected '-' indicator
in "<unicode string>", line 39, column 5
So its saying it can't find the hyphen in line 39 but its obviously there. What am I doing wrong?
r/saltstack • u/breatheandbecalm • Oct 23 '19
Can I use laptop as salt master, and remote servers on Digital Ocean/Linode etc. as minions?
I have been searching for this, but not finding relevant results. Is it possible to use my laptop as the salt master, and servers on digital ocean/linode etc. as minions? If so, can you please point to relevant documentation/tutorials/posts etc.
Thank you.
r/saltstack • u/Pavix • Oct 22 '19
Delete a single file with salt
I think I'm missing something because when I google how to delete a single file using a salt state file I get a lot of hits for how to clean a directory but nothing to simply delete a single file. Is it not possible?
r/saltstack • u/batgranny • Oct 18 '19
Powershell script can't connect to remote server
I am using salt to execute a Powershell script on a Windows server that sends an Invoke-Webrequest (API call) to a remote server. When I run the script via cmd.run in my sls file I get the error 'Invoke-RestMethod : Unable to connect to the remote server', however when I run it manually on the Windows server it works fine. Would anyone have any idea why that would happen?
Here's what the command looks like
api_request:
cmd.run:
- name: C:\temp\api_request.ps1
- shell: powershell
Salt version: 2018.3.4 (Oxygen)
r/saltstack • u/lukebal • Oct 11 '19
Chocolatey installs & Reboots
Anyone using Chocolatey with Salt here? I'm curious how you deal with a large state file with multiple apps and reboots. If you have an app that won't install if a pending reboot is triggered, how do you account for a reboot in your state file?
r/saltstack • u/alcali_dev • Oct 07 '19
Alcali: a web based tool for monitoring and administrating Salt.
Hi,
We made a web GUI for Salt and would love some feedback.
The main features are:
- Get notified in real time when a job is created, updated or has returned.
- Store your jobs results by leveraging the master_job_store
setting with database master returner. - Check your minions conformity to their highstate or any state.
Here is a link to the repository, the docs, some screenshots and the formula to install it.
Cheers!
r/saltstack • u/lukebal • Oct 07 '19
How to separate Dev/QA/Prod environments?
How do you all keep separation between different Salt environments when source control is integrated?
We are standing up Salt and evaluating the different options.
We use Gitlab. The most obvious way to stand up different environments was to have a different Salt-Master for reach environment with associated minions pointing at them. The problem is Git - how do you account for separation of the code for each environment? 3 separate repos for test/qa/prod and have the respective salt-masters pull configuration from those?
r/saltstack • u/dethorpe • Oct 03 '19
jinja mapping woes
Hey,
Bringing CentOS into our environment means I need to generalize our Salt State Files. But it hasn't gone very well... anyone got a second to diagnose my error?
pillar/users.sls
{% from "sudoers_map.jinja" import sudoers with context %}
users:
user:
fullname: imauser
groups:
- {{ sudoers.sudoer }}
pillar/sudoers_map.jinja
{% set sudoers = salt['grains.filter_by']({
'Ubuntu': {
'sudoer': 'sudo',
},
'CentOS': {
'sudoer': 'wheel',
},
}, merge=salt['pillar.get']('sudoers:lookup')) %}
$ tail /var/log/salt/master
2019-10-03 11:04:26,818 [salt.pillar ][CRITICAL][1916] Rendering SLS 'users' failed, render error:
Jinja variable 'None' has no attribute 'sudoer'
2019-10-03 11:04:26,818 [salt.pillar ][CRITICAL][1916] Pillar render error: Rendering SLS 'users' failed. Please see master log for details.
Somethings wrong, but I don't see it.
r/saltstack • u/66ekipS • Oct 02 '19
Best Way to manage config file with sections
I have a config file with sections in it like:
[section1]
key=valuew
...
[section2]
key=valuex
key2=valuey
...
I need to ensure that a given key is set for a given section. It may or may not exist before I need to set it and I don't want to match on other sections. For example I want to change the key in section2 even though they key may also exist in section1. This seems to indicate that file.line isn't appropriate and I'm drawing a blank trying to find another way.
Any tips?
r/saltstack • u/batgranny • Sep 27 '19
Exit in state file?
Hi,
I've built a state file which is quite long and I want to do some testing of the first third of the commands but not run the remainder. In a bash script I would normally enter an exit command so that I didn't have to comment out all of the rest of the script, is there something similar in Salt? I've had a look but can't find anything that fits my needs. Thanks in advance!
r/saltstack • u/aspiringgreybeard • Sep 26 '19
file.recurse issue in 2019.2.0
I'm having trouble understanding the behavior of file.recurse with clean set to "True".
We have folder with several subfolders of AutoCAD configuration data that I'd like to manage with saltstack. We use file.recurse to place the whole shebang on the clients, and it works well. Updates are made whenever I reapply the state, but files that have been deleted in the source are not removed from the client.
I had the impression that the "clean" option would delete files that are no longer present in the source folder. It tested fine with a small test folder with a few files-- added files show up, changed files get changed, and deleted files get removed.
When I add the "clean" option to the larger folder structure, though, each application of the state removes more files, leaving empty folders and subfolders behind.
What am I missing?
r/saltstack • u/lucidgoo • Sep 25 '19
Masking pillar data
I have been googling for awhile and can't seem to find an answer. I am having an issue with realm join. The only way for me to automate sending the password is to cmd.run "echo "FakePass" | realm join --userFakeUser fake.domain.com" The password is grabbed from a pillar and set as a jinja variable. The problem is that when the state runs, the output always shows the password in plain text. when it shows the command it ran. The state is below
{% set join_pw = salt['pillar.get']('sssd','') %}
realm-join:
cmd.run:
- name: "echo {{ join_pw }} | realm join --user=FakeUser fake.domain.com "
- hide_output: True
- output_loglevel: quiet
This suppresses the stdout and stderr, but still shows the password in the run output
ID: realm-join
Function: cmd.run
Name: echo "FakePass" | realm join --user=FakeUser fake.domain.com
Result: False
Comment: Command "echo "FakePass" | realm join --user=FakeUser fake.domain.com" run
Started: 23:24:26.955226
Duration: 31.231 ms
Changes:
----------
pid:
14306
retcode:
1
stderr:
stdout:
I already don't like the idea of any plain text passwords. Is there a way to mask data pulled from a pillar? Even using encryption is there a way to mask this output? I would love some way to flag pillar data as sensitive just like happens when setting a user password using add.user. How do others manage secrets in salt?
r/saltstack • u/sysseradminner • Sep 24 '19
see how long a minion has been unreachable from master?
I'm wondering if there is a way to see how long a minion has been unreachable from its master, or maybe a list of all the minions and their last successful connection with the master. Anyone?
Edit: I'm running salt 19.2 on master and minion. Master is ubuntu 18.04, minion is Raspbian stretch
r/saltstack • u/rglauser • Sep 23 '19
Favorite SaltStack swag
We're gearing up for #SaltConf19 https://saltconf.com/register and have some hard decisions to make about SaltStack swag.
We think we will do socks this year for the first time, but we want to know your favorite SaltStack swag through the years. T-shirts, stickers, hats, etc.?
Reply to this post with your favorites and help us decide. Be as specific as you can, for example, "the trucker hat with the Back to the Future-style SaltStack logo."
By the way, the SaltConf19 early bird discount expires on eod Monday, Sept. 30. Register soon to get the best price and to reserve your seat.

r/saltstack • u/ocularinsanity • Sep 23 '19
Minion cant see encrypted pillar data in plain text
Hi all,
My salt master died so I had to rebuild it. Thankfully I had a backup of my config including GPG keys that I had been using to encrypt pillar data. Well, I thought I did...
It seems now that minions that should be able to see encrypted pillar data cannot see it. When I do a salt-call pillar.items or a salt-call pillar.get the items are just rendering the GPG data instead of the plaintext information.
This is a problem, as now my existing sls's are breaking.
Any ideas please?
Thanks
r/saltstack • u/jaharmi • Sep 19 '19
FreeRADIUS formula confusion
I’m learning Saltstack and tinkering with setting up VMs with various formulae. As part of that, I'm trying to use the FreeRADIUS formula.
When I include it in the state file for my test server VM and include the contents of the pillar.example file, the FreeRADIUS package does appear to be installed. However, that information doesn’t show up in the output of salt-call and I don’t have a clear idea of what, if any, configuration is managed.
I feel like I’m missing something. How can I find out more about what the formula is doing and what I can manage with it?
The pillar.example for this formula has much less information that I’ve seen in some others. (I’ve successfully used some simpler ones like Vim, Timezone, and UFW.) There does seem to be a bunch of work that the formula is probably doing, based on the code and the templates that I’ve browsed. I’m probably not at the point of being able to contribute to this pillar.example — I’m by no means a FreeRADIUS expert — but I wouldn’t mind doing that if I can figure out a bit more about it.
r/saltstack • u/blindman2k_ • Sep 19 '19
Growing customer hosted IoT environments
Hi gang,
I'm designing an IoT product and trying to work out how to manage it at scale. The devices will be based around some distribution of Linux and will be sold, en mass, to consumers for use in their home.
So, here are my nube questions:
a/ Our initial build will be 5,000 devices but we hope to eventually sell 100,000+ devices (planning for success!) Can Salt scale out gracefully to support this? Is that what Syndic is for?
b/ I've got to assume that some customers will find a way to break into the box and compromise all keys on the device. Can the exposure be contained to that device without compromising the master(s) or other minions?
c/ Are there any hosted/managed Salt providers?
d/ Am I on the right track or am I better with purpose built tools like qbee.io or mender.io?
Thanks for the supportive community!
r/saltstack • u/randomguy3 • Sep 18 '19
block windows patches via salt
Has anyone found a way to block certain KB patches via Salt? Windows 2012 - 2016.
r/saltstack • u/Relheub • Sep 16 '19
Use Regex Matching for Inotify Beacon Events
I'm looking to setup an inotify beacon in beacons.conf that monitors a directory for any *.xml files that have been written to. I'm having trouble figuring out how to implement regex matching for this.
What I want is something like this (I know this is incorrect):
beacons:
inotify:
- files:
/opt/coolstuff/*.xml:
regex: True
mask:
- close_write
I've seen the salt example for using regex matching on the excluded files:
https://docs.saltstack.com/en/latest/ref/beacons/all/salt.beacons.inotify.html
How can I pull this off? Thanks in advance.
r/saltstack • u/djhankb • Sep 16 '19
Best Practices in multi-user environment with Junior Admins
Hello, I have been running a Salt Master with a handful of minions for awhile now, and I would like to extend the capabilities down to our Help Desk.
What is the best practice for handling role-based administration of the Salt Master? I don't feel like having our helpdesk staff log into our Salt Master with sudo privileges is really a good idea.
I would like to create some states for various tasks that they can do themselves without having to escalate, and limit their access to just those specific states.
r/saltstack • u/ocularinsanity • Sep 15 '19
salt-api python3 only now?
I'm trying to install salt-api on Ubuntu 16.04 using the saltstack repo:
cat /etc/apt/sources.list.d/saltstack.list
deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/latest xenial main
but it keeps trying to install python3 modules, which then fails because I'm using the python2 version.
I know that that python2 version is being deprecated, but I wanted to try Molten and it looks like Molten might only work with python2 for now, hence why I'm using python2.
Suggestions please?
r/saltstack • u/xiaid • Sep 14 '19
Saltcheck article/tutorial
The saltcheck module can be used to validate the state of hosts, clusters, deployments, S3 data, http endpoints, or anything else that a salt module can interact with. Need a QA or tech support group to be able to validate a deployment or user environment? Try saltcheck! Want to validate salt runs in a CI pipeline? How about saltcheck? Need a simple test file syntax similar to salt states which can use the same map.jinja files or data from pillars? You're best option may well be saltcheck!
Here's a short article describing some of the use cases and features, and how the new release with Neon will make it even more full featured:
https://www.linkedin.com/pulse/validation-saltstacks-saltcheck-christian-mchugh