SlideShare a Scribd company logo
PAGE
1
DEVOPS INDONESIA
Iman Kurniawan
SRE at DKatalis
Jakarta, 14 April 2021
DevOps Indonesia (ONLINE) Meetup #43 :
Introduction to SaltStack
Introduction to SaltStack
(An Event-Based
Configuration Management)
Speaker
Iman Kurniawan
SRE at DKatalis
Previous Experiences:
1. Schlumberger Oilfield Services (Jakarta, Dubai, India)
2. DKatalis (Jakarta)
Can be reached at:
1.https://github.com/footprns
2.https://www.linkedin.com/in/iman-kurniawan-4b738225/
3.https://www.facebook.com/groups/385005352371154/?ref=share
Who’s DKatalis?
● A team of tech and digital product enthusiasts,
focusing on building relevant digital solutions.
● The proud engineering arms that create Jago
digital bank app, Amaan digital platform based on
sharia values, and many more solutions to come.
● Growing rapidly in Jakarta, Singapore & Pune
(India).
● Stimulating growth through technology & enabled
by collaborative environment that fosters
creativity and innovation.
www.dkatalis.co
“Opinions expressed are
solely my own and do not
express the views or
opinions of my employer.”
What is SaltStack
6
● Configuration Management tool that can do orchestration very well
● Written in Python
● Use Client (salt minion) - Server (salt master) architecture
● Using event-driven architecture
● Key based authentication (RSA/AES)
● Oct 2020, acquired by VMWare
● The opensource is in https://docs.saltproject.io/en/latest/
Use Case for SaltStack
7
● SecOps - Apply patch according to CVE
● Prevent configuration drift
● Self-remediation / self-healing
● Setup complex cluster (with orchestration)
● Network Automation (using salt-proxy)
SaltStack Architecture
8
Event System Architecture
● Asynchronous execution
● Events can be observed on Salt Master and Minion
Key Based Authentication
Salt Command and Grains
● salt <target minion> <module>.<function> <arguments>
● Ex. salt salt-minion-001 pkg.install vim
● Grains is an information about underlying system
● There is custom grains
imankurniawan@salt-master-001:~$ sudo salt salt-minion-001 grains.items
salt-minion-001:
----------
biosreleasedate:
01/01/2011
biosversion:
Google
domain:
asia-southeast2-a.c.jago-sre-gcp-poc.internal
fqdn:
salt-minion-001.asia-southeast2-a.c.jago-sre-gcp-poc.internal
fqdn_ip6:
fqdns:
- salt-minion-001.asia-southeast2-a.c.jago-sre-gcp-poc.internal
salt-minion-001
init:
systemd
ip4_gw:
10.106.64.1
kernel:
Linux
lvm:
----------
machine_id:
bbfd6efc4772103b73e837d5fec91028
os:
Ubuntu
os_family:
Debian
saltpath:
/usr/lib/python3/dist-packages/salt
saltversion:
3002.6
shell:
/bin/sh
Salt State
● The state of the host using salt state file (configuration file in yaml format)
● Best practice in salt-formula (https://github.com/saltstack-formulas)
● Example: Last line in text file
add string at the end of file:
file.append:
- name: /tmp/appendfile.txt
- text: last line
Salt Returner
● Result data redirected to external data-stores
● Returner list
○ Cassandra
○ Couchdb
○ Elasticsearch
○ MySQL
○ PostgreSQL
○ MongoDB
○ Slack
○ Splunk
○ Sqlite3
○ Nagios
○ Kafka
○ https://docs.saltproject.io/en/latest/ref/returners/all/index.html
Salt Reactor
● React (run command) if there is a specific
event
salt/job/20210326152042932642/ret/salt-minion-001 {
"_stamp": "2021-03-26T15:20:51.888045",
"cmd": "_return",
"fun": "state.single",
"fun_args": [
{
"fun": "pkg.installed",
"name": "zsh"
}
],
"id": "salt-minion-001",
"jid": "20210326152042932642",
"out": "highstate",
"retcode": 0,
"return": {
"pkg_|-zsh_|-zsh_|-installed": {
"__id__": "zsh",
"__run_num__": 0,
"__sls__": null,
"changes": {
"zsh": {
"new": "5.4.2-3ubuntu3.1",
"old": ""
},
"zsh-common": {
"new": "5.4.2-3ubuntu3.1",
"old": ""
}
},
"comment": "The following packages were installed/updated:
zsh",
"duration": 7516.035,
"name": "zsh",
"result": true,
"start_time": "15:20:44.357773"
}
},
"success": true
}
Salt Beacon
● A process in minion that can translate external events into salt event bus
salt/beacon/salt-minion-001/inotify//etc/important_file {
"_stamp": "2021-03-27T14:25:31.156136",
"change": "IN_IGNORED",
"id": "salt-minion-001",
"path": "/etc/important_file"
}
Salt Orchestration
● Orchestrate order of task and
target
----------
ID: apply on minion1
Function: salt.state
Result: True
Comment: States ran successfully. Updating salt-minion-001.
Started: 03:32:04.587496
Duration: 558.065 ms
Changes:
salt-minion-001:
----------
ID: time stamp for orchestration
Function: file.managed
Name: /tmp/timestamp.txt
Result: True
Comment: File /tmp/timestamp.txt updated
Started: 03:32:05.018703
Duration: 12.949 ms
Changes:
----------
diff:
New file
Summary for salt-minion-001
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
Total run time: 12.949 ms
----------
ID: apply on minion2
Function: salt.state
Result: True
Comment: States ran successfully. Updating salt-minion-002.
Started: 03:32:05.145740
Duration: 457.751 ms
Changes:
salt-minion-002:
----------
ID: time stamp for orchestration
Function: file.managed
Name: /tmp/timestamp.txt
Result: True
Comment: File /tmp/timestamp.txt updated
Started: 03:32:05.477723
Duration: 11.74 ms
Changes:
----------
diff:
New file
Summary for salt-minion-002
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
Total run time: 11.740 ms
Summary for salt-master-001.asia-southeast2-a.c.jago-sre-gcp-
poc.internal_master
------------
Succeeded: 2 (changed=2)
Failed: 0
------------
Total states run: 2
Total run time: 1.016 s
Salt API
● Execute salt state from API call
curl -sSk https://localhost:8000/login 
-H 'Accept: application/x-yaml' 
-d username=saltdev 
-d password=saltdev 
-d eauth=pam
curl -sSk https://localhost:8000 
-H 'Accept: application/x-yaml' 
-H 'X-Auth-Token: 2cceff677b76d4b668653bae4055ee471547c2d7'
-d client=local 
-d tgt='*' 
-d fun=test.ping
1
8
Tips and Tricks
● Don’t execute raw shell script. Execute raw shell as last option
● Use jinja for as template engine
● Separate code logic and configuration value
● Use best practices from salt-formula
● Use virtual environments for salt-minion to avoid python version/update conflict (OS
or application)
● Use salt environment approach
● Use vault to store secret
● Put salt state in git repo and release as salt using CI/CD or use gitfs
● Advance topic, salt proxy, salt syndic (master of master), salt cloud (IaC)
More Information About DKatalis
Website : https://dkatalis.co/
Job Opportunity : https://dkatalis.com/opportunity
LinkedIn : DKatalis (Digital Katalis)
https://www.linkedin.com/company/dkatalis/jobs/
Instagram : @dkatalis
https://www.instagram.com/dkatalis/
2
0
Reference
● https://www.digitalocean.com/community/tutorials/an-introduction-to-saltstack-
terminology-and-concepts#tutorial_series_53
● SaltStack-Admin
● https://docs.saltproject.io/
Introduction to SaltStack (An Event-Based Configuration Management)
PAGE
22
DEVOPS INDONESIA
Stay Connected
@devopsindonesia
http://www.devopsindonesia.com
@IDDevOps
@DevOpsIndonesia
@IDDevOps DevOps Indonesia
Alone We are smart, together We are brilliant
THANK YOU !
Quote by Steve Anderson

More Related Content

What's hot (19)

PDF
[TechTalks] Learning Configuration Management with SaltStack (Advanced Concepts)
Blazeclan Technologies Private Limited
 
PDF
OpenWest 2014-05-10 Where's the Waldo, SaltStack Proxy Minions
croldham
 
PPTX
Nagios intro
Hsi-Kai Wang
 
PPTX
Salt stack introduction
Muzammil Rehman
 
PDF
OMD and Check_mk
Artur Martins
 
PDF
SaltConf14 - Craig Sebenik, LinkedIn - SaltStack at Web Scale
SaltStack
 
PDF
Install telnet Linux
VCP Muthukrishna
 
PDF
Nagios nrpe
sharad chhetri
 
PDF
TryStack: A Sandbox for OpenStack Users and Admins
Anne Gentle
 
PDF
Red Hat Satellite
Katsutoshi Kojima
 
PDF
SaltStack
Patrick Pierson
 
PDF
Openstack trystack
Eueung Mulyana
 
PDF
Using RPM's to Automagically to install Oracle Agents to EM12C
Secure-24
 
PDF
Techzone 2014 presentation rundeck
Joel Richard Moya Lupe
 
PDF
Linux conna kpatch-without-stopmachine-fixed
Tommy Lee
 
PDF
RUDDER - Continuous Configuration (configuration management + continuous aud...
RUDDER
 
PPTX
Ksplice - Keep your Database systems up to date with no downtime
Luis Marques
 
PPT
Rackspace Private Cloud presentation for ChefConf 2014
Joe Breu
 
PDF
[2018.10.19] 김용기 부장 - IAC on OpenStack (feat. ansible)
OpenStack Korea Community
 
[TechTalks] Learning Configuration Management with SaltStack (Advanced Concepts)
Blazeclan Technologies Private Limited
 
OpenWest 2014-05-10 Where's the Waldo, SaltStack Proxy Minions
croldham
 
Nagios intro
Hsi-Kai Wang
 
Salt stack introduction
Muzammil Rehman
 
OMD and Check_mk
Artur Martins
 
SaltConf14 - Craig Sebenik, LinkedIn - SaltStack at Web Scale
SaltStack
 
Install telnet Linux
VCP Muthukrishna
 
Nagios nrpe
sharad chhetri
 
TryStack: A Sandbox for OpenStack Users and Admins
Anne Gentle
 
Red Hat Satellite
Katsutoshi Kojima
 
SaltStack
Patrick Pierson
 
Openstack trystack
Eueung Mulyana
 
Using RPM's to Automagically to install Oracle Agents to EM12C
Secure-24
 
Techzone 2014 presentation rundeck
Joel Richard Moya Lupe
 
Linux conna kpatch-without-stopmachine-fixed
Tommy Lee
 
RUDDER - Continuous Configuration (configuration management + continuous aud...
RUDDER
 
Ksplice - Keep your Database systems up to date with no downtime
Luis Marques
 
Rackspace Private Cloud presentation for ChefConf 2014
Joe Breu
 
[2018.10.19] 김용기 부장 - IAC on OpenStack (feat. ansible)
OpenStack Korea Community
 

Similar to Introduction to SaltStack (An Event-Based Configuration Management) (20)

KEY
Ruby and Rails Packaging to Production
Fabio Kung
 
PDF
Loadays managing my sql with percona toolkit
Frederic Descamps
 
PDF
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
Symantec
 
PPTX
How Honestbee Does CI/CD on Kubernetes - Vincent DeSmet
DevOpsDaysJKT
 
PPTX
Best Deep Learning Post from LinkedIn Group
Farshid Pirahansiah
 
ODP
Monitoring IO performance with iostat and pt-diskstats
Ben Mildren
 
PPTX
Magento 2 Deploy Strategies
Rafael Corrêa Gomes
 
PPTX
Shareplex Presentation
David Breinholt
 
PDF
The SaltStack Pub Crawl - Fosscomm 2016
effie mouzeli
 
PPTX
Joget Workflow v6 Training Slides - 16 - Preparing Development Environment
Joget Workflow
 
PDF
Introduction To The Junos Operating System 22a Juniper Networks
decqogw888
 
PDF
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
DECK36
 
PDF
Chicago Docker Meetup Presentation - Mediafly
Mediafly
 
PDF
Oracle Database Management Basic 1
Chien Chung Shen
 
PPT
vBACD - Introduction to Opscode Chef - 2/29
CloudStack - Open Source Cloud Computing Project
 
PDF
Oracle 11g R2 RAC setup on rhel 5.0
Santosh Kangane
 
PDF
[2C4]Clustered computing with CoreOS, fleet and etcd
NAVER D2
 
PPTX
Django Deployment-in-AWS
Mindfire Solutions
 
PPTX
Webcast - Making kubernetes production ready
Applatix
 
PDF
Whitepaper MS SQL Server on Linux
Roger Eisentrager
 
Ruby and Rails Packaging to Production
Fabio Kung
 
Loadays managing my sql with percona toolkit
Frederic Descamps
 
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
Symantec
 
How Honestbee Does CI/CD on Kubernetes - Vincent DeSmet
DevOpsDaysJKT
 
Best Deep Learning Post from LinkedIn Group
Farshid Pirahansiah
 
Monitoring IO performance with iostat and pt-diskstats
Ben Mildren
 
Magento 2 Deploy Strategies
Rafael Corrêa Gomes
 
Shareplex Presentation
David Breinholt
 
The SaltStack Pub Crawl - Fosscomm 2016
effie mouzeli
 
Joget Workflow v6 Training Slides - 16 - Preparing Development Environment
Joget Workflow
 
Introduction To The Junos Operating System 22a Juniper Networks
decqogw888
 
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
DECK36
 
Chicago Docker Meetup Presentation - Mediafly
Mediafly
 
Oracle Database Management Basic 1
Chien Chung Shen
 
vBACD - Introduction to Opscode Chef - 2/29
CloudStack - Open Source Cloud Computing Project
 
Oracle 11g R2 RAC setup on rhel 5.0
Santosh Kangane
 
[2C4]Clustered computing with CoreOS, fleet and etcd
NAVER D2
 
Django Deployment-in-AWS
Mindfire Solutions
 
Webcast - Making kubernetes production ready
Applatix
 
Whitepaper MS SQL Server on Linux
Roger Eisentrager
 
Ad

More from DevOps Indonesia (20)

PDF
DevSecOps Implementation Journey
DevOps Indonesia
 
PDF
DevOps Indonesia X Palo Alto and Dkatalis Roadshow to DevOpsDays Jakarta 2022
DevOps Indonesia
 
PDF
Securing an NGINX deployment for K8s
DevOps Indonesia
 
PDF
DevOps Indonesia Meetup #52 - announcement
DevOps Indonesia
 
PDF
Dev ops meetup 51 : Securing DevOps Lifecycle - Announcement
DevOps Indonesia
 
PDF
Securing DevOps Lifecycle
DevOps Indonesia
 
PDF
DevOps Meetup 50 : Securing your Application - Announcement
DevOps Indonesia
 
PDF
Secure your Application with Google cloud armor
DevOps Indonesia
 
PDF
DevOps Meetup 49 Aws Copilot and Gitops - announcement by DevOps Indonesia
DevOps Indonesia
 
PDF
Operate Containers with AWS Copilot
DevOps Indonesia
 
PDF
Continuously Deploy Your CDK Application by Petra novandi barus
DevOps Indonesia
 
PDF
DevOps indonesia (online) meetup 46 aws with payfazz in devops indonesia - a...
DevOps Indonesia
 
PDF
Securing Your Database Dynamic DB Credentials
DevOps Indonesia
 
PDF
DevOps Indonesia (online) meetup 45 - Announcement
DevOps Indonesia
 
PDF
The Death and Rise of Enterprise DevOps
DevOps Indonesia
 
PDF
API Security Webinar - Credential Stuffing
DevOps Indonesia
 
PDF
API Security Webinar - Security Guidelines for Providing and Consuming APIs
DevOps Indonesia
 
PDF
API Security Webinar - Hendra Tanto
DevOps Indonesia
 
PDF
API Security Webinar : Credential Stuffing
DevOps Indonesia
 
PDF
API Security Webinar : Security Guidelines for Providing and Consuming APIs
DevOps Indonesia
 
DevSecOps Implementation Journey
DevOps Indonesia
 
DevOps Indonesia X Palo Alto and Dkatalis Roadshow to DevOpsDays Jakarta 2022
DevOps Indonesia
 
Securing an NGINX deployment for K8s
DevOps Indonesia
 
DevOps Indonesia Meetup #52 - announcement
DevOps Indonesia
 
Dev ops meetup 51 : Securing DevOps Lifecycle - Announcement
DevOps Indonesia
 
Securing DevOps Lifecycle
DevOps Indonesia
 
DevOps Meetup 50 : Securing your Application - Announcement
DevOps Indonesia
 
Secure your Application with Google cloud armor
DevOps Indonesia
 
DevOps Meetup 49 Aws Copilot and Gitops - announcement by DevOps Indonesia
DevOps Indonesia
 
Operate Containers with AWS Copilot
DevOps Indonesia
 
Continuously Deploy Your CDK Application by Petra novandi barus
DevOps Indonesia
 
DevOps indonesia (online) meetup 46 aws with payfazz in devops indonesia - a...
DevOps Indonesia
 
Securing Your Database Dynamic DB Credentials
DevOps Indonesia
 
DevOps Indonesia (online) meetup 45 - Announcement
DevOps Indonesia
 
The Death and Rise of Enterprise DevOps
DevOps Indonesia
 
API Security Webinar - Credential Stuffing
DevOps Indonesia
 
API Security Webinar - Security Guidelines for Providing and Consuming APIs
DevOps Indonesia
 
API Security Webinar - Hendra Tanto
DevOps Indonesia
 
API Security Webinar : Credential Stuffing
DevOps Indonesia
 
API Security Webinar : Security Guidelines for Providing and Consuming APIs
DevOps Indonesia
 
Ad

Recently uploaded (20)

PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
July Patch Tuesday
Ivanti
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 

Introduction to SaltStack (An Event-Based Configuration Management)

  • 1. PAGE 1 DEVOPS INDONESIA Iman Kurniawan SRE at DKatalis Jakarta, 14 April 2021 DevOps Indonesia (ONLINE) Meetup #43 : Introduction to SaltStack
  • 2. Introduction to SaltStack (An Event-Based Configuration Management)
  • 3. Speaker Iman Kurniawan SRE at DKatalis Previous Experiences: 1. Schlumberger Oilfield Services (Jakarta, Dubai, India) 2. DKatalis (Jakarta) Can be reached at: 1.https://github.com/footprns 2.https://www.linkedin.com/in/iman-kurniawan-4b738225/ 3.https://www.facebook.com/groups/385005352371154/?ref=share
  • 4. Who’s DKatalis? ● A team of tech and digital product enthusiasts, focusing on building relevant digital solutions. ● The proud engineering arms that create Jago digital bank app, Amaan digital platform based on sharia values, and many more solutions to come. ● Growing rapidly in Jakarta, Singapore & Pune (India). ● Stimulating growth through technology & enabled by collaborative environment that fosters creativity and innovation. www.dkatalis.co
  • 5. “Opinions expressed are solely my own and do not express the views or opinions of my employer.”
  • 6. What is SaltStack 6 ● Configuration Management tool that can do orchestration very well ● Written in Python ● Use Client (salt minion) - Server (salt master) architecture ● Using event-driven architecture ● Key based authentication (RSA/AES) ● Oct 2020, acquired by VMWare ● The opensource is in https://docs.saltproject.io/en/latest/
  • 7. Use Case for SaltStack 7 ● SecOps - Apply patch according to CVE ● Prevent configuration drift ● Self-remediation / self-healing ● Setup complex cluster (with orchestration) ● Network Automation (using salt-proxy)
  • 9. Event System Architecture ● Asynchronous execution ● Events can be observed on Salt Master and Minion
  • 11. Salt Command and Grains ● salt <target minion> <module>.<function> <arguments> ● Ex. salt salt-minion-001 pkg.install vim ● Grains is an information about underlying system ● There is custom grains imankurniawan@salt-master-001:~$ sudo salt salt-minion-001 grains.items salt-minion-001: ---------- biosreleasedate: 01/01/2011 biosversion: Google domain: asia-southeast2-a.c.jago-sre-gcp-poc.internal fqdn: salt-minion-001.asia-southeast2-a.c.jago-sre-gcp-poc.internal fqdn_ip6: fqdns: - salt-minion-001.asia-southeast2-a.c.jago-sre-gcp-poc.internal salt-minion-001 init: systemd ip4_gw: 10.106.64.1 kernel: Linux lvm: ---------- machine_id: bbfd6efc4772103b73e837d5fec91028 os: Ubuntu os_family: Debian saltpath: /usr/lib/python3/dist-packages/salt saltversion: 3002.6 shell: /bin/sh
  • 12. Salt State ● The state of the host using salt state file (configuration file in yaml format) ● Best practice in salt-formula (https://github.com/saltstack-formulas) ● Example: Last line in text file add string at the end of file: file.append: - name: /tmp/appendfile.txt - text: last line
  • 13. Salt Returner ● Result data redirected to external data-stores ● Returner list ○ Cassandra ○ Couchdb ○ Elasticsearch ○ MySQL ○ PostgreSQL ○ MongoDB ○ Slack ○ Splunk ○ Sqlite3 ○ Nagios ○ Kafka ○ https://docs.saltproject.io/en/latest/ref/returners/all/index.html
  • 14. Salt Reactor ● React (run command) if there is a specific event salt/job/20210326152042932642/ret/salt-minion-001 { "_stamp": "2021-03-26T15:20:51.888045", "cmd": "_return", "fun": "state.single", "fun_args": [ { "fun": "pkg.installed", "name": "zsh" } ], "id": "salt-minion-001", "jid": "20210326152042932642", "out": "highstate", "retcode": 0, "return": { "pkg_|-zsh_|-zsh_|-installed": { "__id__": "zsh", "__run_num__": 0, "__sls__": null, "changes": { "zsh": { "new": "5.4.2-3ubuntu3.1", "old": "" }, "zsh-common": { "new": "5.4.2-3ubuntu3.1", "old": "" } }, "comment": "The following packages were installed/updated: zsh", "duration": 7516.035, "name": "zsh", "result": true, "start_time": "15:20:44.357773" } }, "success": true }
  • 15. Salt Beacon ● A process in minion that can translate external events into salt event bus salt/beacon/salt-minion-001/inotify//etc/important_file { "_stamp": "2021-03-27T14:25:31.156136", "change": "IN_IGNORED", "id": "salt-minion-001", "path": "/etc/important_file" }
  • 16. Salt Orchestration ● Orchestrate order of task and target ---------- ID: apply on minion1 Function: salt.state Result: True Comment: States ran successfully. Updating salt-minion-001. Started: 03:32:04.587496 Duration: 558.065 ms Changes: salt-minion-001: ---------- ID: time stamp for orchestration Function: file.managed Name: /tmp/timestamp.txt Result: True Comment: File /tmp/timestamp.txt updated Started: 03:32:05.018703 Duration: 12.949 ms Changes: ---------- diff: New file Summary for salt-minion-001 ------------ Succeeded: 1 (changed=1) Failed: 0 ------------ Total states run: 1 Total run time: 12.949 ms ---------- ID: apply on minion2 Function: salt.state Result: True Comment: States ran successfully. Updating salt-minion-002. Started: 03:32:05.145740 Duration: 457.751 ms Changes: salt-minion-002: ---------- ID: time stamp for orchestration Function: file.managed Name: /tmp/timestamp.txt Result: True Comment: File /tmp/timestamp.txt updated Started: 03:32:05.477723 Duration: 11.74 ms Changes: ---------- diff: New file Summary for salt-minion-002 ------------ Succeeded: 1 (changed=1) Failed: 0 ------------ Total states run: 1 Total run time: 11.740 ms Summary for salt-master-001.asia-southeast2-a.c.jago-sre-gcp- poc.internal_master ------------ Succeeded: 2 (changed=2) Failed: 0 ------------ Total states run: 2 Total run time: 1.016 s
  • 17. Salt API ● Execute salt state from API call curl -sSk https://localhost:8000/login -H 'Accept: application/x-yaml' -d username=saltdev -d password=saltdev -d eauth=pam curl -sSk https://localhost:8000 -H 'Accept: application/x-yaml' -H 'X-Auth-Token: 2cceff677b76d4b668653bae4055ee471547c2d7' -d client=local -d tgt='*' -d fun=test.ping
  • 18. 1 8 Tips and Tricks ● Don’t execute raw shell script. Execute raw shell as last option ● Use jinja for as template engine ● Separate code logic and configuration value ● Use best practices from salt-formula ● Use virtual environments for salt-minion to avoid python version/update conflict (OS or application) ● Use salt environment approach ● Use vault to store secret ● Put salt state in git repo and release as salt using CI/CD or use gitfs ● Advance topic, salt proxy, salt syndic (master of master), salt cloud (IaC)
  • 19. More Information About DKatalis Website : https://dkatalis.co/ Job Opportunity : https://dkatalis.com/opportunity LinkedIn : DKatalis (Digital Katalis) https://www.linkedin.com/company/dkatalis/jobs/ Instagram : @dkatalis https://www.instagram.com/dkatalis/
  • 23. Alone We are smart, together We are brilliant THANK YOU ! Quote by Steve Anderson