Configuration Managment Best Practice: List of Packages to install

Package names do differ on different platforms. Some call it httpd some apache2… Imagine your product supports RedHat, SuSE and Ubuntu. Each in two versions. Do you keep six lists of packages to install in your configuration management? AFAIK this question is valid for all common products like Salt, Puppet, Chef, Ansible Update This question … Read more

SaltStack: install packages based on role

I would like to install Nagios plugins based on server role. The solution below works but I’m sure there is a more elegant/recommended way to achieve the same – any help would be appreciated. I don’t like this explicit dictionary in merge statement and nested for loop. Pillar: nagios: nrpe: allowed_hosts: 127.0.0.1 plugins: all: – … Read more

What does bind to interface mean in Salt?

In the SaltStack master configuration there is the interface option: https://docs.saltstack.com/en/latest/ref/configuration/master.html It specifies the “The local interface to bind to”. What does that mean? I’ve looked everywhere. Answer The doc is just referring to an attached network interface, probably an ethernet port in your case; it looks like the default is already 0.0.0.0 which is … Read more

Minion management from salt server

I have done salt server set up on ( ubuntu 12.04)and minion(windows server 2008 r2) as per http://salt.readthedocs.org/ , Now i want to copy a folder includes .Exe files on it to minion in specific path and execute it, where my salt-minion(win 2008 r2) is having credentials ? Answer For file management, there’s a salt … Read more

SaltStack: create ssh keypair and add it to authorized_keys

Goal For testing, we want this to work: ssh $USER@localhost. create rsa keypair in ~/.ssh/, if not already there add .ssh/id_rsa.pub to .ssh/authorized_keys, if not already in this file. Question How to do this with salt-stack? Answer State: generate_ssh_key_my_user: cmd.run: – name: ssh-keygen -q -N ” -f /home/my_user/.ssh/id_rsa – runas: my_user – unless: test -f … Read more

Saltstack grains error in template file

Using {{ grains[‘host’] }} in a managed file returns the following error: Function: file.managed Result: False Comment: Unable to manage file: Jinja variable dict object has no element Undefined; line 54 name = {{ grains[‘host’] }} <====================== Sls: /usr/file.conf: file.managed: – source: salt://file.jinja – template: jinja – user: root – group: root – mode: 644 … Read more

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/.root_483e1e_salt/salt-call”, line 15, in <module> salt_call() File “/var/tmp/.root_483e1e_salt/py2/salt/scripts.py”, line 395, in salt_call import salt.cli.call File “/var/tmp/.root_483e1e_salt/py2/salt/cli/call.py”, line 8, in <module> import salt.cli.caller File “/var/tmp/.root_483e1e_salt/py2/salt/cli/caller.py”, line 18, in <module> import salt.loader File “/var/tmp/.root_483e1e_salt/py2/salt/loader.py”, line 27, in … Read more

Outputting salt-mine data into template

Can anyone spot my error here. I have the following in the minion config: mine_functions: network.interfaces: [] I expect the following to return the IP of all minions: {% for ip in salt[‘mine.get’](‘*’, ‘network.interfaces’, [‘eth0′]).items() %} {{ ip }} {% endfor %} The state fails with the following: Unable to manage file: Jinja error: ‘list’ … Read more