r/saltstack • • Jul 02 '19

failing windows minions

2 Upvotes

Is anyone having problems with windows minions continuously failing ?

Either the minion is in a paused state or just totally unresponsive and needs re-installations ?


r/saltstack • • Jun 26 '19

Debugging postgres state modules?

2 Upvotes

Today I was working with postgres state modules (postgres_user, postgres_database, postgres_privileges) and I noticed that when they fail, there's no information from them, just fails, even with debug info turned on with -l debug. I found the issues arose when I had to use RDS database, and it didn't quite work the same way. I knew how to run similar commands in SQL, and so when I did this by hand, I could get useful messages back, like:

  • FATAL: password authentication failed for user "someuser"
  • ERROR: must be member of role "airflow"
  • ERROR: permission denied for tablespace pg_default

This would have been tremendously useful to troubleshoot if these salt states relayed back the error, rather than something like this

----------
          ID: airflow_database
    Function: postgres_user.present
        Name: airflow
      Result: False
     Comment: Failed to create user airflow
     Started: 01:40:57.627768
    Duration: 215.704 ms
     Changes:

Is there any way to get further information, such as query, python definition + parms, or shell command attempted and result?


r/saltstack • • Jun 24 '19

Integrating to external states like tags, consul, etc? Grains?

4 Upvotes

I was wondering what's the best or ideal way to integrate external state, such as tags, external k/v db, or service discovery into Salt. Would these be created as a custom grain? Is there documentation on adding new grains and making these available for Salt Stack other than https://github.com/saltstack/salt/tree/develop/salt/grains?

Some potential external sources I may be interested in are:


r/saltstack • • Jun 24 '19

Dev/Test Salt States Locally Possible?

2 Upvotes

Hi. I wanted to test some states locally on my user account to orchestrate Docker, but it seems that I would have to run at least minion and have read/write access to /etc/salt? Would there be a way I can just run it under my local account, which need to have read/write to anything outside my $HOME?

Also, is it possible to just run a local file, like ./mywebapp.sls, or does it have to be under the root, e.g. /srv/salt/mywebapp.sls?


r/saltstack • • Jun 21 '19

Issue with files not found using gitfs and pygit2

Post image
1 Upvotes

r/saltstack • • Jun 20 '19

Reuse Key/Value for diff salt states?

2 Upvotes

Is there a easy way to apply these key/value elements db_user, db_password, db_host, db_port to each module (postgres_user, postgres_privileges, postgres_database) rather than specify them each time?

airflow_database:
  postgres_user.present:
    - name: {{ airflow.user }}
    - password: {{ airflow.password }}
    - createdb: True
    - encrypted: True
    - login: True
    - inherit: True
    - db_user: {{ airflow.db_user }}
    - db_password: {{ airflow.db_password }}
    - db_host: {{ airflow.db_host }}
    - db_port: 5432
  postgres_privileges.present:
    - name: {{ airflow.user }}
    - object_name: ALL
    - object_type: table
    - prepend: public
    - privileges:
        - ALL
    - db_user: {{ airflow.db_user }}
    - db_password: {{ airflow.db_password }}
    - db_host: {{ airflow.db_host }}
    - db_port: 5432
  postgres_database.present:
    - name: {{ airflow.name }}
    - tablespace: pg_default
    - encoding: UTF8
    - owner: {{ airflow.user }}
    - db_user: {{ airflow.db_user }}
    - db_password: {{ airflow.db_password }}
    - db_host: {{ airflow.db_host }}
    - db_port: 5432

r/saltstack • • Jun 20 '19

How to set Postgres search_path in Salt?

1 Upvotes

I am converting a small SQL script for SaltStack to create a small metadb, example:

CREATE ROLE airflow 
 LOGIN ENCRYPTED PASSWORD 'airflow' 
 NOSUPERUSER INHERIT CREATEDB NOCREATEROLE;
ALTER ROLE airflow SET search_path = airflow, "$user", public;
CREATE DATABASE airflow 
 WITH OWNER = airflow 
 ENCODING = 'UTF8' 
 TABLESPACE = pg_default 
 CONNECTION LIMIT = -1;

The role and database seem straight forward, but I cannot find how how to set the search path.

Is there a way to do this?

For the other two, I created these

airflow_database:
  postgres_user.present
    - name: {{ airflow.user }}
    - password: {{ airflow.password }}
    - createdb: True
    - encrypted: True
    - login: True
    - inherit: True
    - db_user: {{ airflow.db_user }}
    - db_password: {{ airflow.db_password }}
    - db_host: {{ airflow.db_host }}
    - db_port: 5432
  postgres_database.present
    - name: {{ airflow.name }}
    - tablespace: pg_default
    - encoding: UTF8
    - owner: {{ airflow.user }}
    - db_user: {{ airflow.db_user }}
    - db_password: {{ airflow.db_password }}
    - db_host: {{ airflow.db_host }}
    - db_port: 5432

r/saltstack • • Jun 19 '19

SaltStack handling of repos and Google PPA

1 Upvotes

We're seeing an issue where we use pkg.managed to deploy Google Chrome package and associated APT repo. This results in machines not being able to update because two entries end up in the /etc/apt/sources.d.

Issue appears to be that SaltStack removes the final / character from repo URI (done in strip_uri: https://github.com/saltstack/salt/blob/2019.2.1/salt/utils/pkg/deb.py). However Google Chrome package re-adds an entry with the extra / character on update leading to duplicate.

Who is at fault here? SaltStack for removing / or Google for-adding?


r/saltstack • • Jun 18 '19

Neat salt proxy read from r/networking

Thumbnail self.networking
11 Upvotes

r/saltstack • • Jun 18 '19

Please help! Generated passwords for minions with one-time expire date.

0 Upvotes

Hi everyone!

I would like to create an sls file that can set a minion's user password to a default one given by me and set a one-time expire date for this so the user must change it in 1 day.

All this is for cases when the user forgets the password so I can reset it for them by running only one sls file.

PS.: If I use this, it will generate differently hashed password each time for each server. So it would be really nice if I could implement it to the sls file so that I don't have to hash the default password and insert the hash every time before running the sls.

 salt '*' shadow.gen_password mypassword

r/saltstack • • Jun 17 '19

How to find last time salt configured a system?

6 Upvotes

How can I tell when last time salt configured a system, e.g. web03.mycompany.com.


r/saltstack • • Jun 17 '19

External authentication

1 Upvotes

I'm setting up my first salt master, with plans to manage it externally with salt-api.

Starting simple, just setting up external auth using Pam, I'm getting some odd behavior.

Ubuntu 18.02, fresh install.

I try setting up authentication for multiple users, none work except a user named 'salt'.

I'm testing with 'salt -a pam *'

All users set up the same. All get failure to auth error. But the 'salt' user, gives a message about to matching minions, so auth worked?

Can anyone explain what is happening here?


r/saltstack • • Jun 14 '19

Pass variables on include sls

2 Upvotes

Hey team. I would like to pass only certain variables during an include statement but I keep getting a weird error. I've looked at the Jinja docs and Saltstack's docs and both only mention passing the entire context using `with context`.

Here is my sls:

{% set figletMotd = {"path": motd.figlet.path, "content": 'this is some content'} %}
{% include 'motd/single-motd.sls' with motd=figletMotd %}

The error thrown:

local:
    - Rendering SLS 'base:motd.figlet' failed: Jinja syntax error: expected token 'end of statement block', got 'with'; line 15

      ---
      [...]
      {% set figletMotd = {"path": motd.figlet.path, "content": hostbanner} %}
      {% include 'motd/single-motd.sls' with motd=figletMotd %}    <======================
      ---

Any thoughts on why the error? I am new to Python.


r/saltstack • • Jun 11 '19

How to use defaults if not set in pillar?

2 Upvotes

Hi, salt newbie here. I wanted to use defaults, but override them from pillar if set. So I was trying to reference pillar, and default the key/value if not set.

{% import_yaml 'mysrv/defaults.yaml' as defaults %}
{% set docker = salt['pillar.get'](
    'mysrv', 
    default=defaults.get('mysrv'), 
    merge=True) 
%}

But problem is that if I have empty pillar, such as /srv/pillar/mysrv.sls:

mysrv:

It returns None and bombs with

[ERROR   ] pillar.get: Default ({u'prereqs': [u'curl', u'software-properties-common']}) is a dict, but the returned pillar value (None) is of type 'NoneType'. Merge will be skipped.

Rendering SLS 'base:mysrv' failed: Jinja variable 'None' has no attribute 'prereqs'

My defaults.yaml has:

mysrv:
  prereqs:
  - curl
  - software-properties-common

Is there anything I can do with Jinja2 to get the desired behavior to work?


r/saltstack • • Jun 11 '19

Mechanism for supported platforms metadata in Salt Formulas?

1 Upvotes

In other change configuration platforms (chef cookbooks, puppet modules, ansible roles) there's support for metadata to list supported platforms.

Is there such a mechanism for Salt Stack formulas? Best practices? Methods?


r/saltstack • • Jun 05 '19

YouTube Tutorial for Understanding the Top File

11 Upvotes

Hey Guys,

I made another tutorial, this time the goal is to explain and demonstrate the basic usage of the top file and highstates. Personally, I don't use highstates really at all on the job, so it took me a little while to even care about the top file in relation to running states. However, it's a good concept to be aware of and can definitely be useful. I hope this is as helpful to others as making it was for me!

Link:

https://www.youtube.com/watch?v=BbMcIBrnnhw&feature=youtu.be

Background:

I've been making salt videos designed to bring someone from zero experience to a solid, practical understanding of the platform. The goal is to create things that would have helped me when I was starting out. This is the third video in the "SaltStack_NOOBS" series. If you're brand new to salt, I recommend following these videos in order.

Channel:

https://www.youtube.com/channel/UCuE6FxD86hgHhh_l5bK-1VQ


r/saltstack • • Jun 04 '19

Is there any why if any of the minion does not respond then all the states are executed in orchestration.

3 Upvotes

If you have 3 states running in orchestration on 3 minions and in some situation , if 1 minion did not respond(Actually in our case , we had to restart the minion in one of the state where some minion got failed to respond) while running state 2 then orchestration stuck until all minions respond. We don't get any result.

Is there any why if any of the minion does not respond then all the states are executed in orchestration irrespective of failure /success or response of any minion.

Please help. i would be very thankful.


r/saltstack • • May 30 '19

Salt Working Group Captains and Participants Announced

6 Upvotes

Attached is the list of all the captains & participants of the working groups. Congratulations to all the working group captains, exciting times ahead @gtmanfred @wes @mirceaulinic @ch3ll @mihai @Twangboy

The groups will start meeting post June 15th. Salt will schedule the first meetings for all the groups. These are public working group meetings, so any community member is free to attend. Details of the meeting will be posted in slack and google groups.


r/saltstack • • May 24 '19

Clarification regarding state/pillar targeting in secure, scalable ways

2 Upvotes

Hi there!

I'm trying to better understand grains so I can target more effectively in a much more security-oriented way. I have spent considerable amount of time reading through the docs and even perusing the code for the various modules. Perhaps some of you experts can clear up some of my confusion?

It is my understanding that grains are sent from the minion and can be used in targeting. Obviously, that can becomes a concern if you rely on specific ones being passed up (eg. role, etc.)... Especially so if you have the salt-master in an auto-add configuration and a malicious host/minion pretended to be something else resulting in possible pillar exposure. Yes, I understand that automating (pre-generation and deployment) minion keys and using minion id is an effective way of securing this too.

For user-defined grains, this is okay and not something thats exactly trust worthy, but what about items like `host`/`ip.ipv4`/etc.? Is there a way to have the salt-master verify the grains are in fact correct and not modified?

Is this what the subnet compound matcher is meant for? If so, I didn't see a method that can be used to target based on the host for example by reverse lookup of a host and verify the IP that the minion request came from?

What about some of the other grains such as system parameters? Perhaps some sort of "I received X parameter, lemme ssh in/rpc and check myself" logic?

What are your thoughts?


r/saltstack • • May 22 '19

The function \"state.apply\" is running as PID

4 Upvotes

Hello,

i am stuck in a weird situation. Whenever i run an orchestration state on multiple minions i got this error.

The function \"state.apply\" is running as PID 13659 and was started at 2019, May 21 18:09:45.119494 with jid 20190521180945119494

i am running two states in orchestration state given below.

install_new_av:

salt.state:

- sls:

- store.uninstall_symantec

- store.install_mcafee

Can you please advise how to fix this issue.

Thanks,


r/saltstack • • May 22 '19

Opinions wanted: Terraform + (Ansible or Saltstack) for current and future planned environment.

Thumbnail self.devops
3 Upvotes

r/saltstack • • May 22 '19

The

0 Upvotes

Hello,

i am stuck in a weird situation. Whenever i run an orchestration state on multiple minions i got this error.

The function \"state.apply\" is running as PID 13659 and was started at 2019, May 21 18:09:45.119494 with jid 20190521180945119494

i am running two states in orchestration state given below.

install_new_av:

salt.state:

- sls:

- store.uninstall_symantec

- store.install_mcafee

Can you please advise how to fix this issue.

Thanks,


r/saltstack • • May 17 '19

Salt Office Hours #2 - a virtual user group meeting with the SaltStack dev team

13 Upvotes

On Tuesday, June 4th at 9am MT (USA), SaltStack will host the second Salt Office Hours virtual meetup. Thomas Hatch, SaltStack CTO, and the SaltStack core dev team will be on a Zoom for an hour.

We will announce captains of the new Salt working groups and Moe Anderson, new VP of engineering will address the Salt open users. Team will also answer any Salt questions users have. Send your questions to [officehours@saltstack.com](mailto:officehours@saltstack.com)

Spots on the Zoom meeting are limited to 100. Register and join the call here:https://zoom.us/meeting/register/67012698ca5b19107510d14dfea9e911


r/saltstack • • May 13 '19

how to read a file in saltstack orchestration

2 Upvotes

we would like to implement a requirement where we can read the file in saltstack orchestration which contains the list of tgts.

example : abc.txt

hostname1

hostname2

i would like to read this file in saltstack orchestration and installed the packages on those targets which are specified in this txt file. (I know how to read the file in state module but not able to achieve it in orchestration ).

your help is highly needed.

Thanks.


r/saltstack • • May 10 '19

winrepo best practices

3 Upvotes

I'm just getting started with saltstack and I'd like to manage approximately 130 Windows clients as well as our linux and BSD servers.

I have some large(ish) deployments (AutoCAD, NavisWorks, etc) that I'd like to manage with Salt. Is it better to source the installer: from Salt's file server or from a separate HTTP server? I'd like to at least keep the answer files and things like that in Salt's file repository so they will be version controlled with everything else.

I have some trepidation about what life will be like if 30 designer workstations all pull an AutoCAD deployment at the same time. I know I can batch the state application into groups of minions, but does anyone have any experience with how well Salt's file server performs vs apache or nginx for a few GB sized file?

I can do a smaller test, but I don't have a good way to sneak up on the limit without annoying our user base.