Questions tagged [salt-stack]

The Salt Project, previously known as SaltStack, is a Python-based open-source configuration management software and remote execution engine.

Salt is an open source tool to manage your infrastructure. Easy enough to get running in minutes and fast enough to manage tens of thousands of servers and still get a response back in seconds.

Execute arbitrary shell commands or choose from dozens of pre-built modules of common (or complex) commands. Target individual servers or groups of servers based on name, defined roles, or a variety of system information such as hardware, software, operating system, current version, current environment, and many more.

Bring your servers up to a known configured state by writing simple lists of items and defining attributes on those lists.

Links

See also the saltstack tag on Server Fault.

1444 questions
14
votes
1 answer

how to render and dump the file sls with salt stack without applying it

Given how flexible jinja templating can be with saltstack and the numerous pillar variables are merged into the template; I would find it useful to be able to get salt to 'render' the full sls out to screen before i push it out. Is there a way of…
yee379
  • 6,498
  • 10
  • 56
  • 101
14
votes
4 answers

Linting Salt states without running them

I am using Saltstack in a homelab, and I often find myself checking in slightly-broken rules when testing them. I would like to be able to check them for validity, and otherwise lint them, locally and on a Jenkins instance, but I can't find any…
Alexander Bauer
  • 10,663
  • 8
  • 29
  • 40
14
votes
4 answers

How do I pass parameters to a salt state file?

I want to create a group and user using salt state files, but I do not know the group, gid, user, uid, sshkey until I need to execute the salt state file which I would like to pass in as parameters. I have read about Pillar to create the variable.…
Ryan Currah
  • 1,067
  • 6
  • 15
  • 30
14
votes
2 answers

Saltstack for "configure make install"

I'm getting my feet wet with SaltStack. I've made my first state (a Vim installer with a static configuration) and I'm working on my second one. Unfortunately, there isn't an Ubuntu package for the application I'd like my state to install. I will…
nomen
  • 3,626
  • 2
  • 23
  • 40
13
votes
5 answers

How do I append to each item in a list of strings?

I have a list of strings containing IP addresses. I want to append a port number to each of them. In python I would do it something like this: ip_list = [(ip + ":" + port) for ip in ip_list] ...but Jinja doesn't support list comprehensions. At the…
Andrew
  • 4,058
  • 4
  • 25
  • 37
13
votes
3 answers

How to join two Salt pillar files and merge data?

Is there any way to join two pillar files? I have a users pillar. It's something like: users: joe: sudouser: True jack: sudouser: False Now I need different set of users for certain servers (ie. add some users to one server). So I…
Tomáš Fejfar
  • 11,129
  • 8
  • 54
  • 82
13
votes
2 answers

Set environment variable using saltstack

I am writing some salt stack formulas which will install tomcat package. but after installation I have to set JAVA_HOME in /etc/default/tomcat7 file. Is there any option to set JAVA_HOME? Or is there any option to modify or add JAVA_HOME in…
Naveen Subramani
  • 2,134
  • 7
  • 20
  • 27
13
votes
3 answers

How can I dump pillar data, that will be send to minion

When I do highstate at minion, there is a strange error. I suspect, that the pillar data on the minion may not be right. Can I somehow dump the pillar data from minion?
Tomáš Fejfar
  • 11,129
  • 8
  • 54
  • 82
12
votes
3 answers

Jinja2 map list to dictionary

Is it possible to convert list of primitives to list of dicts using Jinja2 using list/map comprehensions? Given this structure: list: - some_val - some_val_2 Apply map on every element to obtain: list: - statically_added: some_val -…
lakier
  • 550
  • 4
  • 16
12
votes
2 answers

What does 'with context' mean when doing an import?

I've been looking for an explanation in the SaltStack docs about what 'with context' means. But there's only examples of using context. What is 'context'? What does it do here? And why is Debian ignored in the map.jinja file? (for example…
Sonia Hamilton
  • 4,229
  • 5
  • 35
  • 50
12
votes
8 answers

Salt minion returns no response after being accepted

After setting up the salt-master and one minion, I am able to accept the key on the master. Running sudo salt-key -L shows that it is accepted. However, when I try the test.ping command, the master shows: Minion did not return. [No response] On…
Toby
  • 12,743
  • 8
  • 43
  • 75
12
votes
3 answers

Check file exists and create a symlink

I want to do something like that: if file A exists or there is no symlink B, I want to create a symlink B -> A. For now I have: B: file: - symlink: - target: A - exists: - name: A But this is bad it checks not the thing…
Darek
  • 2,861
  • 4
  • 29
  • 52
12
votes
7 answers

How to get IP address of hostname inside jinja template

Our saltstack is based on hostnames (webN., dbN., etc.). But for various things I need IPs of those servers. For now I had them stored in pillars, but the number of places I need to sync grows. I tried to use publish + network.ip_addrs, but that…
Tomáš Fejfar
  • 11,129
  • 8
  • 54
  • 82
11
votes
2 answers

Repository structure for a saltstack project

I'm starting on a new project and I'd like to use SaltStack for managing a large deployment spanning several datacenters. Everything runs on Linux. I had previous experience with Chef but I relatively new to SaltStack. My goal is to keep the entire…
dtoux
  • 1,754
  • 3
  • 21
  • 38
11
votes
1 answer

How can I validate a salt minion's key fingerprint before accepting it on the master?

When I build a new server, I collect the ssh key fingerprints from the console before my initial connections over the network using ssh. I'd like to be able to get the same out-of-band assurance when using salt. With salt, when a new minion starts…
Jim Cheetham
  • 453
  • 3
  • 8
1
2
3
96 97