Good tool for automatic setup and deployment of Django projects

2021 update Today I'm using Ansible for this and other devops tasks. Along the way I've experimented with Chef, Puppet, Saltstack and Docker images, but I've found that for me, as a solo...

python - extract a specific key / value from json file by a variable

a bit new to python and json. i have this json file: { "hosts": { "example1.lab.com" : ["mysql", "apache"], "example2.lab.com" : ["sqlite", "nmap"], ...

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...

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...

Remove the empty lines left by Jinja2 variable definitions

When writing template files using Jinja2 for Saltstack, I often define some variables at the beginning of the file. For example: {% set ip = grains['ip4_interfaces']['eth1'][0] %} {% set domain =...

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...

Idiomatic way to inject parameters with python decorators

So, this is a 2 part question - Is there an idiomatic way in python to inject a parameter into the function signature when using a decorator? For example: def _mydecorator(func): def...

SaltStack gitfs issue

I'm learning saltstack using docker containers (bbinet/salt-master and bbinet/salt-minion), but can't get gitfs running. I'll need to run some containers later in production, so i'm trying to...

Failed to run install_fedora_deps when starting up local kubernetes cluster

I am running my local kubernetes v1.1.4 cluster on Ubuntu 14.04 using vagrant 1.8.1 and virtualbox 4.3.28. Everything worked fine but since last friday 22.01.2016 i keep getting the same error...

Docker yum install issue - Cannot retrieve metalink for repository: epel/x86_64

While doing yum install from docker file getting the following error message in Centos 7 docker build -f DockerFile . Sending build context to Docker daemon 1.252 MB Step 1 : FROM centos:7 --->...

SaltStack - Managed file gets written on every run, how to only write the file if there are updates?

I'm having some trouble where my managed files are being written on every state run, even if there was nothing that updated in the file. Oddly enough, I can't seem to find anything about stopping...

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...

saltstack 'Pillar failed to render with the following messages'

I'm getting the following error message when I do a state.apply: [ERROR ] Data passed to highstate outputter is not a valid highstate return: {'sonia9': ['Pillar failed to render with the...

How do I disable cortana from the command line?

I'm using SaltStack to configure some Windows 10 machines and one of the things I need to do is disable Cortana. I know that i can easily be disabled from its own settings is there way to do this...

How to get minion id from jinja script inside a salt state

I need to apply a if-else logic based on a static minion id inside a state file. The target glob qualifies a whole bunch of servers, but I need to run a small piece of logic on a single server and...

SaltStack processing json file

Is it possible to process json file by saltstack that is located on minions using states functionality? I'm sure that it should be possible to do using jinja's functionality, but can't find any...

Is there any difference between "json" and "tojson" filters in jinja for saltstack?

According to saltstack documentation it's "json": https://docs.saltstack.com/en/latest/ref/renderers/all/salt.renderers.jinja.html But in jinja...

Saltstack get grains of a minion in orchestration

I'm using salt-cloud to deploy VMs and I'm trying to get them registred in my DNS with the Saltstack Reactor system. I have a reactor.conf with this trigger: reactor: - 'salt/cloud/*/created': ...

Jinja Template dict/list filter "contains" or "like" - Saltstack

I would like to filter on value that contain or start with 'foo_' and ignore other values in list. values (Can not be modified): TEST: - foo_a - foo_b - bar_a - bar_b - test_c Template : {% for...

saltstack get the command execution stdout real time for long running process

Am working on automation area for the application patching through saltstack and the actual patching takes hours to completed. In saltstack(based on my understanding), I noticed that the output of...

Change ossec(wazuh) agent profiles via saltstack

I'm trying to modify the <config-profile> section of a ossc.conf file, including a grains content. something like: ossec-profiles: - profile1 - profile2 and I want to modify the section...

saltstack - how to get minions that match a grain or pillar?

Is there an easier way to get a list of minions that match a particular grain or pillar? Let's say I want to know all my Ubuntu 18.x hosts. Today I run: $ sudo salt -G oscodename:bionic test.ping...

Saltstack module is not available

Trying to run sls but the salt tells me the function is not available My sls. Must create a mongodump file create-dump: module.run: - name: docker.run - m_name: mongo - cmd: 'mongodump...

Problem with salt-master and salt-minion connection in Docker

I am having problem in connecting salt-master and salt-minion in latest version ubuntu. https://bitbucket.org/jmarhee/saltstack-docker/src I used this reference, but as it was using older version...

How to install PostgreSQL 13 with Saltstacked state?

The title is basically the question. I am using CentOS 8 and want to start using Saltstack states to install stuff like Postgresql-13, AdoptOpenJDK,... install-postgresql13-repository: ...

How to pass parameters to an SLS file via another SLS file in SaltStack?

I have an SLS file in SaltStack Orchestrator which contains something like this: Plan A: salt.state: - tgt: my-server - sls: service-a Plan B: salt.state: - tgt: my-server -...

saltstack jinja for loop in parallel

hope to find you well and healthy :) I have one jinja loop which is working, unfortunately not the way I would like :| Short story: Using salt-run for orchestration, minion targeting is...

Firewalld: Adding a source to multiple zones, gives Error: ZONE_CONFLICT .. Is there another way?

I've come up with a role based design for provisioning my firewalld zones with Saltstack. Practically speaking I'm using zones more as logical groups. For instance, all servers in a certain group...

Use minion targeting within Jinja templates

SaltStack allows for precise targeting of minions on the command-line, e.g.: salt 'prefix*' grains.items ^^^^^^^ Is there some way to use the same way of targeting minions within Jinja...

Saltstack send event to minions from master in python script

I'm trying to send an event from my salt master (Linux) to the minions (Windows) event bus. On the master I can execute salt 'MyMinion' event.fire '{"foo": "bar"}' 'custom/tag' On the minion I...