SlideShare a Scribd company logo
Event–Driven Self–Healing Infrastructure
with​ SALTSTACK
SaltStack is a complete systems management software platform for scalable
orchestration and automation of any infrastructure or application stack. Salt is built
around an event infrastructure that can be leveraged and extended to drive reactive
provisioning, configuration, and management across all devices in your infrastructure.
Salt’s internal components communicate with each other by sending and listening to
events. In Salt, events are sent for about everything you could imagine.
Benefits of event-driven architecture:
An event-driven architecture can help to achieve a flexible system that can adapt to
changes and make decisions in real time. Real-time situational awareness means that
business decisions, whether manual or automated, can be made using all of the
available data that reflects the current state of your systems.
SALTSTACK Components:
Salt Master:​ ​Central management system. This system is used to send commands and
configurations to the Salt minion that is running on managed systems.
Salt Minions:​Managed system. This system runs the Salt minion which receives commands
and configuration from the Salt master.
Formulas (States):​A declarative or imperative representation of a system configuration.
Grains:​System variables. Grains are static information about the underlying managed system
and include operating system, memory, and many other system properties. You can also define
custom grains for any system.
Pillar:​User-defined variables. These secure variables are defined and stored on the Salt
Master and then ‘assigned’ to one or more minions using targets. Salt pillar data stores values
such as ports, file paths, configuration parameters, and passwords.
Beacons:​Beacons let you use the Salt event system to monitor non-Salt processes.When
monitored activity occurs in a system process, an event is sent on the Salt event bus that can
be used to trigger a reactor.
1> Beacons are deployed on Salt Minions.
2> It uses modules to monitor systems.
3> publish messages to Salt event bus
Salt beacons can currently monitor and send Salt events for many system activities, including:
● file system changes - ​INOTIFY
● system load - ​MEMUSAGE
● service status - ​SERVICE
● disk usage - ​DISKUSAGE
Reactor:​Salt's Reactor system gives Salt the ability to trigger actions in response to an event.
It is a simple interface to watching Salt's event bus for event tags that match a given pattern and
then running one or more commands in response.
1> Reactors are defined on Salt Master
2> Reads messages from Salt event bis
3> Maps events to reactor SLS file based on configuration file
Lets configure with existing Salt setup, In this practical
will demonstrate beacons SERVICE module.
Master node ip​ - 192.168.0.10 ​- hostname - ​master-node-0-10
Minion node ip ​- 192.168.0.20 ​- hostname - ​minion-node-0-20
Minion configurations:
Install prerequisites:
yum install -y python2-psutil python-inotify python-pip
create config file for beacons:
vim /etc/salt/minion.d/beacons.conf
beacons:
service:
- services:
nginx:
onchangeonly: True
restart Salt minion service to reload the configuration
systemctl restart salt-minion
Master configurations:
install prerequisites:
yum install -y python2-psutil python-inotify python-pip
verify the beacons config on minions from Master:
CMD -- salt * beacons.list
output:
minion-node-0-20:
beacons:
service:
- services:
nginx:
onchangeonly: true
create reactor.conf file
vim /etc/salt/master.d/reactor.conf
reactor:
- 'salt/beacon/*/service/*':
- /home/salt/automation/salt/reactor/service.sls
create service.sls file
vim /home/salt/automation/salt/reactor/service.sls
{%- if data[data['service_name']]['running'] == False %}
start {{data['service_name']}}:
local.service.start:
- tgt: {{data['id']}}
- args:
- name: {{data['service_name']}}
{%- endif %}
restart Salt master service to reload the configuration
systemctl restart salt-master
NOW let's stop the Nginx service on minion and see the logs in
Master with below command. Here will break the log in 4 stages and
explain each of them.
run on master node - salt-run state.event pretty=true
STAGE 1-​ ​Beacons sends event to salt master event bus for Nginx service not
running
salt/beacon/​minion-node-0-20​/service/nginx {
"_stamp": "2020-05-25T18:50:32.654503",
"id": "​minion-node-0-20​",
"nginx": {
"running": false
},
"service_name": "nginx"
}
20200525185032777481 {
"_stamp": "2020-05-25T18:50:32.777877",
"minions": [
"​minion-node-0-20​"
]
}
STAGE 2 -​ ​Now runner will check the condition when Nginx service status is
down on minion
salt/job/20200525185032777481/new {
"_stamp": "2020-05-25T18:50:32.778353",
"arg": [
{
"__kwarg__": true,
"name": "nginx"
}
],
"fun": "service.start",
"jid": "20200525185032777481",
"minions": [
"​minion-node-0-20​"
],
"missing": [],
"tgt": "​minion-node-0-20​",
"tgt_type": "glob",
"user": "root"
}
STAGE 3 -​ ​Runner with trigger the command and start the Nginx service on
minion
salt/job/20200525185032777481/ret/​minion-node-0-20 {
"_stamp": "2020-05-25T18:50:32.972192",
"cmd": "_return",
"fun": "service.start",
"fun_args": [
{
"name": "nginx"
}
],
"id": "​minion-node-0-20​",
"jid": "20200525185032777481",
"retcode": 0,
"return": true,
"success": true
}
STAGE 4 -​ ​Once the service is started again beacons will push the event in
master event bus with Nginx status running
salt/beacon/​minion-node-0-20​/service/nginx {
"_stamp": "2020-05-25T18:50:33.658475",
"id": "​minion-node-0-20​",
"nginx": {
"running": true
},
"service_name": "nginx"
}

More Related Content

PDF
Configure Run Levels RHEL 7 or CentOS 7
PPTX
Spacewalk deployment at Fuqua
PDF
How to Install Configure and Use sysstat utils on RHEL 7
PDF
How To Install CentOS 7
PPTX
SaltStack Advanced Concepts
PDF
[TechTalks] Learning Configuration Management with SaltStack (Advanced Concepts)
PDF
Why SaltStack ?
PDF
Introduction to Systems Management with SaltStack
Configure Run Levels RHEL 7 or CentOS 7
Spacewalk deployment at Fuqua
How to Install Configure and Use sysstat utils on RHEL 7
How To Install CentOS 7
SaltStack Advanced Concepts
[TechTalks] Learning Configuration Management with SaltStack (Advanced Concepts)
Why SaltStack ?
Introduction to Systems Management with SaltStack

Similar to Event driven architecture with SaltStack (20)

PPTX
SaltStack Configuration Management
PDF
A user's perspective on SaltStack and other configuration management tools
PDF
Orchestrate Event-Driven Infrastructure with SaltStack
PDF
Introduction to SaltStack
PDF
Understanding salt modular sub-systems and customization
PDF
Intelligent infrastructure with SaltStack
PDF
The SaltStack Pub Crawl - Fosscomm 2016
PDF
Configuration management and orchestration with Salt
PDF
Sweetening Systems Management with Salt
PPTX
Configuration management
PDF
Salt Stack - Subhankar Sengupta
ODP
Configuration Management and Salt
PDF
A3Sec Advanced Deployment System
PPTX
Salt conf15 presentation-william-cannon
PDF
Salt - A Scalable Systems Management Solution for Datacenters
PDF
ODSC 2016 - Scalable Systems Management with Salt Stack by Sebastian Meyer
PDF
OSDC 2016 | Scalable Systems Management with SaltStack by Sebastian Meyer
PDF
OSDC 2016 - Scalable Systems Management with Salt Stack by Sebastian Meyer
PDF
Saltstack for Ansible users
PPTX
Salty OPS – Saltstack Introduction
SaltStack Configuration Management
A user's perspective on SaltStack and other configuration management tools
Orchestrate Event-Driven Infrastructure with SaltStack
Introduction to SaltStack
Understanding salt modular sub-systems and customization
Intelligent infrastructure with SaltStack
The SaltStack Pub Crawl - Fosscomm 2016
Configuration management and orchestration with Salt
Sweetening Systems Management with Salt
Configuration management
Salt Stack - Subhankar Sengupta
Configuration Management and Salt
A3Sec Advanced Deployment System
Salt conf15 presentation-william-cannon
Salt - A Scalable Systems Management Solution for Datacenters
ODSC 2016 - Scalable Systems Management with Salt Stack by Sebastian Meyer
OSDC 2016 | Scalable Systems Management with SaltStack by Sebastian Meyer
OSDC 2016 - Scalable Systems Management with Salt Stack by Sebastian Meyer
Saltstack for Ansible users
Salty OPS – Saltstack Introduction
Ad

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Empathic Computing: Creating Shared Understanding
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PPT
Teaching material agriculture food technology
PDF
Approach and Philosophy of On baking technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Spectroscopy.pptx food analysis technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Big Data Technologies - Introduction.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Empathic Computing: Creating Shared Understanding
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
20250228 LYD VKU AI Blended-Learning.pptx
sap open course for s4hana steps from ECC to s4
Teaching material agriculture food technology
Approach and Philosophy of On baking technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Dropbox Q2 2025 Financial Results & Investor Presentation
Spectroscopy.pptx food analysis technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
Big Data Technologies - Introduction.pptx
Ad

Event driven architecture with SaltStack

  • 1. Event–Driven Self–Healing Infrastructure with​ SALTSTACK SaltStack is a complete systems management software platform for scalable orchestration and automation of any infrastructure or application stack. Salt is built around an event infrastructure that can be leveraged and extended to drive reactive provisioning, configuration, and management across all devices in your infrastructure. Salt’s internal components communicate with each other by sending and listening to events. In Salt, events are sent for about everything you could imagine. Benefits of event-driven architecture: An event-driven architecture can help to achieve a flexible system that can adapt to changes and make decisions in real time. Real-time situational awareness means that business decisions, whether manual or automated, can be made using all of the available data that reflects the current state of your systems. SALTSTACK Components: Salt Master:​ ​Central management system. This system is used to send commands and configurations to the Salt minion that is running on managed systems. Salt Minions:​Managed system. This system runs the Salt minion which receives commands and configuration from the Salt master. Formulas (States):​A declarative or imperative representation of a system configuration. Grains:​System variables. Grains are static information about the underlying managed system and include operating system, memory, and many other system properties. You can also define custom grains for any system.
  • 2. Pillar:​User-defined variables. These secure variables are defined and stored on the Salt Master and then ‘assigned’ to one or more minions using targets. Salt pillar data stores values such as ports, file paths, configuration parameters, and passwords. Beacons:​Beacons let you use the Salt event system to monitor non-Salt processes.When monitored activity occurs in a system process, an event is sent on the Salt event bus that can be used to trigger a reactor. 1> Beacons are deployed on Salt Minions. 2> It uses modules to monitor systems. 3> publish messages to Salt event bus Salt beacons can currently monitor and send Salt events for many system activities, including: ● file system changes - ​INOTIFY ● system load - ​MEMUSAGE ● service status - ​SERVICE ● disk usage - ​DISKUSAGE Reactor:​Salt's Reactor system gives Salt the ability to trigger actions in response to an event. It is a simple interface to watching Salt's event bus for event tags that match a given pattern and then running one or more commands in response. 1> Reactors are defined on Salt Master 2> Reads messages from Salt event bis 3> Maps events to reactor SLS file based on configuration file
  • 3. Lets configure with existing Salt setup, In this practical will demonstrate beacons SERVICE module. Master node ip​ - 192.168.0.10 ​- hostname - ​master-node-0-10 Minion node ip ​- 192.168.0.20 ​- hostname - ​minion-node-0-20 Minion configurations: Install prerequisites: yum install -y python2-psutil python-inotify python-pip create config file for beacons: vim /etc/salt/minion.d/beacons.conf beacons: service: - services: nginx: onchangeonly: True restart Salt minion service to reload the configuration systemctl restart salt-minion Master configurations: install prerequisites: yum install -y python2-psutil python-inotify python-pip verify the beacons config on minions from Master: CMD -- salt * beacons.list output: minion-node-0-20: beacons: service:
  • 4. - services: nginx: onchangeonly: true create reactor.conf file vim /etc/salt/master.d/reactor.conf reactor: - 'salt/beacon/*/service/*': - /home/salt/automation/salt/reactor/service.sls create service.sls file vim /home/salt/automation/salt/reactor/service.sls {%- if data[data['service_name']]['running'] == False %} start {{data['service_name']}}: local.service.start: - tgt: {{data['id']}} - args: - name: {{data['service_name']}} {%- endif %} restart Salt master service to reload the configuration systemctl restart salt-master NOW let's stop the Nginx service on minion and see the logs in Master with below command. Here will break the log in 4 stages and explain each of them. run on master node - salt-run state.event pretty=true STAGE 1-​ ​Beacons sends event to salt master event bus for Nginx service not running salt/beacon/​minion-node-0-20​/service/nginx { "_stamp": "2020-05-25T18:50:32.654503", "id": "​minion-node-0-20​", "nginx": { "running": false },
  • 5. "service_name": "nginx" } 20200525185032777481 { "_stamp": "2020-05-25T18:50:32.777877", "minions": [ "​minion-node-0-20​" ] } STAGE 2 -​ ​Now runner will check the condition when Nginx service status is down on minion salt/job/20200525185032777481/new { "_stamp": "2020-05-25T18:50:32.778353", "arg": [ { "__kwarg__": true, "name": "nginx" } ], "fun": "service.start", "jid": "20200525185032777481", "minions": [ "​minion-node-0-20​" ], "missing": [], "tgt": "​minion-node-0-20​", "tgt_type": "glob", "user": "root" } STAGE 3 -​ ​Runner with trigger the command and start the Nginx service on minion salt/job/20200525185032777481/ret/​minion-node-0-20 { "_stamp": "2020-05-25T18:50:32.972192", "cmd": "_return", "fun": "service.start", "fun_args": [
  • 6. { "name": "nginx" } ], "id": "​minion-node-0-20​", "jid": "20200525185032777481", "retcode": 0, "return": true, "success": true } STAGE 4 -​ ​Once the service is started again beacons will push the event in master event bus with Nginx status running salt/beacon/​minion-node-0-20​/service/nginx { "_stamp": "2020-05-25T18:50:33.658475", "id": "​minion-node-0-20​", "nginx": { "running": true }, "service_name": "nginx" }