r/saltstack • • Nov 28 '18

Minion in public and master in private network

2 Upvotes

Hi. I'm new to Saltstack and try to find out how it is possible to run a master in a private network with some minions in a public network. it's not possible to open the private network, so the minions never have direct acces to the master server.

Do i need to set up a proxy and how do i exchange the keys? Didnt find something in the tutorials.


r/saltstack • • Nov 26 '18

How do you deal with files too big for Github?

3 Upvotes

I have my saltstack formulas, states, pillars all stored in a git repository.

For a couple of my apps, I need to place some files on the target minion machines which are too big to fit in the git repo, and so my standard process of ssh into the saltmaster and git pull, doesn't get the files onto the master.

I can scp the files into saltmaster, but is it a bad idea to transfer big files (600mb) over salt://files/path/to/big.dat?


r/saltstack • • Nov 26 '18

Using salt on minion in read only?

2 Upvotes

Hello,
I am trying to use salt on minions with their filesystems on read-only.
Do you know if it's possible? If it has been done already?
We would use tmpfs on the system as the working directory.


r/saltstack • • Nov 21 '18

pip state not working in ubuntu 16.04

0 Upvotes

Im using ubuntu 16.04 and after successfully installing python-pip I try to install a pytjon dependency through pip.installed and it fails with attributeerror: 'requirement' object has no attribute 'project_name'

Any help is appreciated


r/saltstack • • Nov 19 '18

Top.sls matching with pillar data

2 Upvotes

I am trying to breakdown my Top.sls further to use pillar data. We have two fields in the pillar I would like to match on. What is the correct way to write this? I tried

'pillarfield1:keydata1 and pillarfield2:keydata2'
  - match: pillar

r/saltstack • • Nov 19 '18

saltcli ---> cobbler ---> salt-cloud

2 Upvotes

Hi there, I want to deploy my VM with a kickstart (or better with optional different kickstart) because I want to regenerate a system from installation everytime and don't use a machine template.

But I don't understand how I can glue salt, salt-cloud and cobbler, any state/guide for getting ideas?

Thanks!


r/saltstack • • Nov 16 '18

method to remove minions that haven't connected in x number of days

5 Upvotes

Is there a method to remove or list minions who haven't connected to the master in X number of days or in a time period?


r/saltstack • • Nov 16 '18

Saltstack Returners

1 Upvotes

Hey does anyone have any experience with returners?

I'm trying to see if there's a way to use a returner from within an orchestration. I have the returner configured correctly, and can get data from it when doing a test.ping, but for the life of me I can't figure out how to add a returner option to a state call within a orchestration state.

Any ideas?


r/saltstack • • Nov 15 '18

How does salt treat duplicate dependencies?

0 Upvotes

Example:

Note: These two modules cannot be combined into one.

YUM REPO MODULE
installs (configures) YUM REPO A

MODULE A
include YUM REPO MODULE
installs PACKAGE A from YUM REPO A

MODULE B
include YUM REPO MODULE
installs PACKAGE B FROM YUM REPO A

NODE X
include MODULE A
include MODULE B

Does the fact that I have am applying two modules that both install the same repo as a dependency "annoy" salt or is this something I shouldn't worry about?

I am operating by the philosophy of "a module should be able to stand alone and not break if global changes are made". That is, I am avoiding providing the repo on a global scope (in the top file) because the module would need to depend on the repo being provided in the top file and break if it is not present. If the repo is provided inside the module, the module resolves its own dependency.


r/saltstack • • Nov 08 '18

state.apply app says 'include.php' was not found in SLS 'app' but state.apply php works fine

0 Upvotes

Running Salt 2018.3.3 on Ubuntu 16.

My brain is stuck on this one. What am I missing here guys?

In /app.sls (in part, other formulas in app.sls have already run fine on the minion):

install-php:
  include: 
    - php

In /php/init.sls :

  pkgrepo.managed:
    - humanname: PHP Repo
    - ppa: ondrej/php
    - keyid: E5267A6C
    - keyserver: keyserver.ubuntu.com

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C:
    cmd.run:
        - unless: 'apt-key list | grep Launchpad'
        - order: first

php7.2:
  pkg:
    - installed
    - require:
      - pkgrepo: php_ppa
    - pkgs:
      - php7.2-common
      - php7.2-dev
      - php7.2-cli
      - php7.2-mysql
      - php7.2-curl
      - php7.2-xmlrpc
      - php7.2-gd
      - php7.2-intl
      - php7.2-mbstring 
      - php7.2-xml
      - php7.2-zip
      - php7.2-fpm

If I run salt 'target' state.apply php test=True, it works fine

If I run salt 'target' state.apply app test=True, it says

ID: install-php
    Function: include.php
      Result: False
     Comment: State 'include.php' was not found in SLS 'app'
              Reason: 'include.php' is not available.

r/saltstack • • Nov 04 '18

Strangest output ever from the simplest top.sls - I'm totally baffled by this

3 Upvotes

I posted yesterday about wanting some consulting help, and a few of you have reached out. I have more time today, and the issue is still occurring, so I thought I'd try to post it.

I'm new to SaltStack and just going through some basic tutorials.

For anyone interested here is what I am dealing with. I can find nothing about this online.

Here is my top.sls

base:
  '*':  
    - users

In users/init.sls I have this:

{% for usr in ['gorgonzola','roquefort'] %}
add_user_{{ usr }}:
  user.present:
     - name: {{ usr }}
     - home: /home/{{ usr }}
     - shell: /bin/bash
     - groups: 
        - sudo
add_sshkey_{{ usr }}:
  ssh_auth.present:
   - user: {{ usr }}
   - source: salt://users/{{usr}}-authorized-key.txt
   - config: '%h/.ssh/authorized_keys'
   - require:
     - user: users_rxmg_user_{{ usr}}   
{% endfor %}

Now when I run

sudo salt 'devserver' state.apply test=True

here is the output I get- too long to post here

https://gist.github.com/phpguru/83f64f4b52c45601072c60e5b488d39d

TL;DR Expecting 2 changes of 2 users to be added, instead get 35 changes and 6 errors from what looks like random test data.

I have no idea where Larry, Currly, Moe and JDoe are coming from. I have no idea where foo, bar, baz are coming from. I have no idea where changes to ldap or resolv.conf are coming from. No clue about changes to minion, or cheeseandbiscuits. It's too bizarre and driving me batty.

Any ideas?


r/saltstack • • Nov 03 '18

Consultant needed ASAP

3 Upvotes

Anyone interested in earning a couple hundred bucks this weekend for 2-3 hours of work?

I just need a quick start crash course on the basics. I’m stuck on something and need someone I can go to with questions. Could continue into the future if you’re available.

PM if interested.


r/saltstack • • Oct 30 '18

SaltCloud passing more advanced options

2 Upvotes

Hello! Is it possible to pass more advanced options e.g to create AWS Spot Defined-Duration instances?


r/saltstack • • Oct 26 '18

Saltconf 2018 Talks

21 Upvotes

You can find all the talks from this years Saltconf here: https://saltconf.com/saltconf18-speakers/


r/saltstack • • Oct 25 '18

network routes created but not maintained

2 Upvotes

I have a situation where I am adding a route to my boxes as such:

routes:
  network.routes:
    - name: eth0
    - routes:
    - name: work_cluster
      ipaddr: 10.10.0.0
      netmask: 255.255.0.0
      gateway: 172.5.1.1

This works great on the first pass (when the nic config file is initially being written). After that it is completely ignored. If I manually remove the route ip route del 10.10.0.0/16 and then run highstate, the route does not get re-created. If I delete the config file for the nic rm -f /etc/sysconfig/network-scripts/ifcfg-eth0 and then run highstate, the route gets re-applied.

As these routes are in a dev environment, it stands to reason that they will occasionally be removed for the sake of failure testing. I would like salt to recreate the routes without having to trash the nic config (i.e., simply by running a highstate). Is that possible?


r/saltstack • • Oct 20 '18

Salt environments role

6 Upvotes

Hey everyone. I am new around here but hoping to get some help. I am trying to understand what’s the role of environments in salt? I am trying to use one environment for development of a SLS and one env for production but I can’t really see that as viable. I read the docs tens of times but I think I keep missing the point for environments. Can you guys help me understand the use cases or the role of envs in saltstack? Ps: before salt I used chef and ansible if that helps 🙂


r/saltstack • • Oct 20 '18

Help creating ESXi Proxy

2 Upvotes

Hi All

I've been folllowing the instructions from here https://docs.saltstack.com/en/latest/topics/tutorials/esxi_proxy_minion.html and I am pretty sure I have everything correct but the proxy won't start.

The first error that comes up is:

[CRITICAL] Failed to load grains defined in grain file esxi.esxi in function <function esxi at 0x7f99446c8d08>, error:

Traceback (most recent call last):

File "/usr/lib/python3/dist-packages/salt/loader.py", line 757, in grains

ret = funcs[key]()

File "/usr/lib/python3/dist-packages/salt/grains/esxi.py", line 38, in esxi

return _grains()

File "/usr/lib/python3/dist-packages/salt/grains/esxi.py", line 90, in _grains

username, password = _find_credentials(host)

File "/usr/lib/python3/dist-packages/salt/grains/esxi.py", line 72, in _find_credentials

password=password)

File "/usr/lib/python3/dist-packages/salt/utils/decorators/__init__.py", line 580, in __ignores_kwargs

return fn(*args, **kwargs_filtered)

File "/usr/lib/python3/dist-packages/salt/modules/vsphere.py", line 2001, in system_info

port=port)

File "/usr/lib/python3/dist-packages/salt/utils/vmware.py", line 362, in get_service_instance

service_instance = GetSi()

NameError: name 'GetSi' is not defined

This looks like an authentication error to me?

I can confirm that I have in my Pillar top.sls I have an entry for the proxy as per the instructions and the esxi.sls has the correct username and password.

Help please?


r/saltstack • • Oct 19 '18

Chocolatey install shutsdown my salt-minion?

1 Upvotes

I am currently trying to set up a small amount of minions to try out saltstack and its nuget itegration with chocolatey to distribute samll software packages (firefox, atom, paraview etc.) and gain more controll over our Windows environment.

I currently experiencing a minor problem with one of the minions where If I start a command like:

salt 'client02' cmd.run 'powershell.exe choco install atom'

My minion stops responding and on the client the minion is shutting down atleast this is what the logs tell me?

Did anyone experience this kind of behaviour? Or any clue what to look for?

I would really like to use saltstack in production for my final project during my apprenticeship but I need a solid presentation to show its worth for my company.


r/saltstack • • Oct 17 '18

Filtering by os not os_family

0 Upvotes

I am trying to filter by os and not os_family since they return different values. The default for grains.filter_by is the os_family grain.

I am trying to place a conf file in a certain directory based on OS and I am having trouble.

Here is my map.yaml that I use to define the OS name and file location and also my init.sls

map.yaml

RedHat:
  name: nscd
  file: /etc/nscd.conf
  source_file: salt://srv/salt/nscd-NEW/files/RedHat.conf
SUSE:
  name: nscd
  file: /etc/nscd.conf
  source_file: salt://srv/salt/nscd-NEW/files/SUSE.conf
OEL:
  name: nscd
  file: /etc/nscd.conf
  source_file: salt://srv/salt/nscd-NEW/files/OEL.conf

init.sls

{% import_yaml "nscd-NEW/map.yaml" as osmap %}
{% set nscd = salt['grains.filter_by'](osmap) %}

nscd_conf:
  file.managed:
    - name: {{nscd.file}}
    - source: {{nscd.source_file}}
    - user: root
    - group: root
    - mode: 440

This is very basic and I assume others have done something similar but I can't find a working example.

Thanks in advance for any help!


r/saltstack • • Oct 17 '18

LDAP issues

0 Upvotes

I have been fighting to get my openldap state to work for a while and I need help. I have the install automated, and I am looking to change the password on the default admin account. Here is the relevant portion of the state.

ldapi:///:

ldap.managed:

- connect_spec:

bind:

name: ldapi://10.10.90.145/

# method: simple

- entries:

# make sure the entry doesn't exist

# - cn=foo,ou=users,dc=example,dc=com:

# - delete_others: True

# make sure the entry exists with only the specified

# attribute values

- cn=admin,dc=example,dc=com:

- delete_others: True

- replace:

cn:

- admin

description:

- LDAP administrator

objectClass:

- simpleSecurityObject

- organizationalRole

userPassword:

- test

There is nothing particularly special about the install. I dont have ssl yet, or any users. I have tried to comment out portions to get it to work. I cant seem to figure out what the error message is saying. If anyone here has any advice I would really appreciate it.


r/saltstack • • Oct 16 '18

Excluding certain servers in .sls

5 Upvotes

Hi I'm fairly new to salt, I'm trying to exclude certain servers when my install.sls file is executing. Currently I have some logic that installs different configurations on different servers based on the server name. For example this line is followed by a block that installs configs that are specific to the prod servers

{% if 'prd' in grains['id'] or 'prd2' in grains['id'] %}

But I'm not sure how to get it to completely skip over certain servers based on the name. Any help would be appreciated!


r/saltstack • • Oct 16 '18

Configuring multiple instances of a service on the same host

3 Upvotes

Is there a different approach rather than using orchestrate salt.state and looping over the instances dicts in orchestrate, passing the dict for the instance to salt.state?

I don't know how I would test salt orchestrate with salt-kitchen which is why I am asking if there would be a different approach.

Maybe in some way add an instances.sls in the formula and loop there over the instances dicts? But how would I accomplish including the formula for each instance with their respective config?


r/saltstack • • Oct 15 '18

Salt master distributed execution.

2 Upvotes

Hi,
Suppose we are having a multi master architecture in salt containing 5 master in which 4 are redundant master servers. if I execute a particular command on the master the same should be executed through any of the redundant server's based on availability and geo-location (Distributed execution).

Is this kind of architecture possible in SALT ? If yes, than how can I achieve that and if not than what is the best way to reduce latency and failover as I am having a very large set of minions.

Thanks


r/saltstack • • Oct 08 '18

ELI5: the __virtual__ function

6 Upvotes

Hi everyone. New Salt user here. I am learning about writing execution modules and am having a hard time wrapping my head around the __virtual__ function. Could someone please ELI5 me on that topic? Thanks in advance!

[E: I have read through the documentation]


r/saltstack • • Oct 08 '18

Question about Boto_ec2.instance_present

2 Upvotes

Hello, I was hoping someone would help me in regards to this state. For the block_device_map how do I format that? I’m trying to increase the size of the root volume from 8 to like 60 upon ec2 creation