SlideShare a Scribd company logo
1 of 19
Download to read offline
Salt for Ansible Users
Paul Traylor
Fukuoka SRE Meetup #2
2019/10/12
1 / 19
Introduction
LINE Fukuoka Server Observability Team
Providing tools for developers to increase their development velocity
Promgen - Prometheus management tool https://github.com/line/promgen
Prometheus as a Service
Grafana as a Service
Sentry as a Service
https://linefukuoka.co.jp/ja/career/list/engineer/Monitoring_System
2 / 19
Agenda
What is Salt ?
Salt intro for Ansible users
Salt for automating (almost) everything
3 / 19
What is Salt ?
Salt is a new approach to infrastructure management built on a dynamic
communication bus. Salt can be used for data-driven orchestration, remote
execution for any infrastructure, configuration management for any app stack,
and much more.
https://docs.saltstack.com/en/latest/
4 / 19
Salt Intro - Master + Minion
By default, Salt uses a Client/Server model
Minions are authenticated using RSA keys
Commands and Results are sent over ZeroMQ by
default
https://docs.saltstack.com/en/getstarted/overview.html
5 / 19
Salt Intro - SSH Mode
Salt also supports an SSH mode which is similar to Ansible
https://docs.saltstack.com/en/getstarted/overview.html
6 / 19
Salt Intro - Master
Running commands is similar to Ansible
# salt <target> <command> <args>
salt '*' test.version
salt 'web*' pkg.install nginx
salt 'database*' state.apply mysql.server test=True
7 / 19
Salt Intro - Minion
But you can also run the same commands on the minion directly
This is super userful for testing and debugging
salt-call test.version
salt-call pkg.install nginx
salt-call state.apply mysql.server test=True
8 / 19
Salt Intro - States
Salt states look similar to Ansible playbooks
States are rendered as Jinja and then loaded as Yaml
/etc/foo.conf:
file.managed:
- source:
- salt://foo.conf.{{ grains['fqdn'] }}
- salt://foo.conf.fallback
- user: foo
- group: users
- mode: 644
- attrs: i
- backup: minion
https://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html
9 / 19
Salt Intro - States
There is no distinction between playbooks and roles, everything is a state
include:
- nginx
/etc/nginx/conf.d/example.conf:
file.managed:
- source: salt://example/example.conf
- template: jinja
10 / 19
Salt Intro - Pillars and Grains
Ansible precidence always confuses me.
https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html
command line values (eg “-u user”)
role defaults [1]
inventory file or script group vars [2]
inventory group_vars/all [3]
playbook group_vars/all [3]
inventory group_vars/* [3]
playbook group_vars/* [3]
inventory file or script host vars [2]
inventory host_vars/* [3]
playbook host_vars/* [3]
host facts / cached set_facts [4]
play vars
play vars_prompt
play vars_files
role vars (defined in role/vars/main.yml)
block vars (only for tasks in block)
task vars (only for the task)
include_vars
set_facts / registered vars
role (and include_role) params
include params
extra vars (always win precedence)
11 / 19
Salt Intro - Pillars and Grains
Pillars come from the salt-master and are for cluster level or secrets
Grains come from the target machine, and are used for things like OS version, CPU
count, memory, etc
Salt gives you flexibility to handle variables how you want
# Import from other files
{% import_yaml "myfile.yml" as myfile %}
{% import_json "defaults.json" as defaults %}
{% import_text "completeworksofshakespeare.txt" as poems %}
{{defaults.port}}
# Read from Grains or Pillars
{{salt['grains.get']('fqdn')}}
{{salt['pillar.get']('role')}}
# or write your own module
{{ salt['vars.get']('example:db:password')}}
https://docs.saltstack.com/en/latest/ref/renderers/all/salt.renderers.jinja.html
12 / 19
Salt for automating - Plugable
https://docs.saltstack.com/en/getstarted/system/plugins.html
13 / 19
Salt for automating
Salt is a new approach to infrastructure management built on a dynamic
communication bus. Salt can be used for data-driven orchestration, remote
execution for any infrastructure, configuration management for any app stack,
and much more.
The dynamic communication bus and well defined plugable architecture makes Salt
significantly more powerful than ansible
https://docs.saltstack.com/en/latest/
14 / 19
Salt for Automating - Returners
Returns provide Salt with a flexibile system
for sending the output of jobs into any
system imagionable
mysql
elasticsearch
kafka
mongodb
slack
https://docs.saltstack.com/en/getstarted/overview.html
https://docs.saltstack.com/en/latest/ref/returners/
15 / 19
Salt for Automating - Reactors
Salt can react to various events within your
system
reactor:
- 'salt/minion/*/start':
- /srv/reactor/start.sls
- /srv/reactor/monitor.sls
- 'salt/cloud/*/destroyed':
- /srv/reactor/destroy/*.sls
- 'myco/custom/event/tag':
- salt://reactor/mycustom.sls
https://docs.saltstack.com/en/getstarted/overview.html
https://docs.saltstack.com/en/latest/topics/reactor/
16 / 19
Salt for Automating - Engines
Salt engines can be used to accept or process internal or external events
engines:
- webhook:
port: 8000
address: 10.128.1.145
ssl_crt: /etc/pki/tls/certs/localhost.crt
ssl_key: /etc/pki/tls/certs/localhost.key
- slack:
token: 'xoxb-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx'
control: True
fire_all: False
- docker_events:
docker_url: unix://var/run/docker.sock
filters:
event:
- start
- stop
- die
- oom
https://docs.saltstack.com/en/latest/topics/engines/index.html
17 / 19
Salt for Automating - Automate Github
Deployments
# salt-master configuration
# Load a simple webhook so that we can easily map GitHub webhooks
engines:
- webhook: {}
reactor:
- 'salt/engines/hook/github':
- salt://_reactor/autodeploy.sls
#!yaml|github
# salt://_reactor/autodeploy.sls
line/promgen: # Whenever we update Promgen
refs/heads/master: # we want to deploy the master branch
deploy-promgen-web:
local.state.sls: # by applying a salt state
- tgt: role:promgen # matching our promgen servers
- tgt_type: pillar
- args:
- mods: promgen.web
- ret: slack # and let me know the result on slack
https://github.com/kfdm/salt-deployhook 18 / 19
Questions ?
https://linefukuoka.co.jp/ja/career/list/engineer/Monitoring_System
19 / 19

More Related Content

What's hot

OpenNebulaconf2017US: Rapid scaling of research computing to over 70,000 cor...
OpenNebulaconf2017US:  Rapid scaling of research computing to over 70,000 cor...OpenNebulaconf2017US:  Rapid scaling of research computing to over 70,000 cor...
OpenNebulaconf2017US: Rapid scaling of research computing to over 70,000 cor...
OpenNebula Project
 
Ruby projects of interest for DevOps
Ruby projects of interest for DevOpsRuby projects of interest for DevOps
Ruby projects of interest for DevOps
Ricardo Sanchez
 

What's hot (20)

OpenNebulaconf2017US: Rapid scaling of research computing to over 70,000 cor...
OpenNebulaconf2017US:  Rapid scaling of research computing to over 70,000 cor...OpenNebulaconf2017US:  Rapid scaling of research computing to over 70,000 cor...
OpenNebulaconf2017US: Rapid scaling of research computing to over 70,000 cor...
 
Devopstore
DevopstoreDevopstore
Devopstore
 
PuppetCamp Sydney 2012 - Building a Multimaster Environment
PuppetCamp Sydney 2012 - Building a Multimaster EnvironmentPuppetCamp Sydney 2012 - Building a Multimaster Environment
PuppetCamp Sydney 2012 - Building a Multimaster Environment
 
Ruby projects of interest for DevOps
Ruby projects of interest for DevOpsRuby projects of interest for DevOps
Ruby projects of interest for DevOps
 
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
 
Microservice Workshop Hands On
Microservice Workshop Hands On Microservice Workshop Hands On
Microservice Workshop Hands On
 
An Introduction to Core 4
An Introduction to Core 4An Introduction to Core 4
An Introduction to Core 4
 
High availability for puppet - 2016
High availability for puppet - 2016High availability for puppet - 2016
High availability for puppet - 2016
 
Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"Sep Nasiri "Upwork PHP Architecture"
Sep Nasiri "Upwork PHP Architecture"
 
Auto infra with_foreman_katello
Auto infra with_foreman_katelloAuto infra with_foreman_katello
Auto infra with_foreman_katello
 
Vmth project
Vmth projectVmth project
Vmth project
 
Managing your SaltStack Minions with Foreman
Managing your SaltStack Minions with ForemanManaging your SaltStack Minions with Foreman
Managing your SaltStack Minions with Foreman
 
Connecting AWS and Katello/The Foreman
Connecting AWS and Katello/The ForemanConnecting AWS and Katello/The Foreman
Connecting AWS and Katello/The Foreman
 
Foreman in your datacenter
Foreman in your datacenterForeman in your datacenter
Foreman in your datacenter
 
Flossuk17 introduction to ovirt
Flossuk17 introduction to ovirtFlossuk17 introduction to ovirt
Flossuk17 introduction to ovirt
 
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
 
CM for MariaDB Galera cluster
CM for MariaDB Galera clusterCM for MariaDB Galera cluster
CM for MariaDB Galera cluster
 
Lifecycle Management with Foreman
Lifecycle Management with ForemanLifecycle Management with Foreman
Lifecycle Management with Foreman
 
SaltConf14 - Saurabh Surana, HP Cloud - Automating operations and support wit...
SaltConf14 - Saurabh Surana, HP Cloud - Automating operations and support wit...SaltConf14 - Saurabh Surana, HP Cloud - Automating operations and support wit...
SaltConf14 - Saurabh Surana, HP Cloud - Automating operations and support wit...
 
Using Perforce Streams to Optimize Development of Flash Memory Solutions
Using Perforce Streams to Optimize Development of Flash Memory SolutionsUsing Perforce Streams to Optimize Development of Flash Memory Solutions
Using Perforce Streams to Optimize Development of Flash Memory Solutions
 

Similar to Saltstack for Ansible users

Ensemble oscon 2011
Ensemble oscon 2011Ensemble oscon 2011
Ensemble oscon 2011
OSCON Byrum
 
ServiceMix 4 -- Integrating OSGi with JBI
ServiceMix 4 -- Integrating OSGi with JBIServiceMix 4 -- Integrating OSGi with JBI
ServiceMix 4 -- Integrating OSGi with JBI
Gert Vanthienen
 
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache TuscanyApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
Jean-Sebastien Delfino
 

Similar to Saltstack for Ansible users (20)

Automating deployments from GitHub using SaltStack
Automating deployments from GitHub using SaltStackAutomating deployments from GitHub using SaltStack
Automating deployments from GitHub using SaltStack
 
Ensemble oscon 2011
Ensemble oscon 2011Ensemble oscon 2011
Ensemble oscon 2011
 
Chicago Docker Meetup Presentation - Mediafly
Chicago Docker Meetup Presentation - MediaflyChicago Docker Meetup Presentation - Mediafly
Chicago Docker Meetup Presentation - Mediafly
 
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability EnvironmentsSaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
SaltConf14 - Ben Cane - Using SaltStack in High Availability Environments
 
整合Cloud Foundry 和 Kubernetes 技術打造企業級雲應用平台解決方案
整合Cloud Foundry 和 Kubernetes 技術打造企業級雲應用平台解決方案整合Cloud Foundry 和 Kubernetes 技術打造企業級雲應用平台解決方案
整合Cloud Foundry 和 Kubernetes 技術打造企業級雲應用平台解決方案
 
Managing and Monitoring Application Performance
Managing and Monitoring Application PerformanceManaging and Monitoring Application Performance
Managing and Monitoring Application Performance
 
Linux Desktop Automation
Linux Desktop AutomationLinux Desktop Automation
Linux Desktop Automation
 
Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con Gitlab
 
Website Testing Practices
Website Testing PracticesWebsite Testing Practices
Website Testing Practices
 
GO-CFを試してみる
GO-CFを試してみるGO-CFを試してみる
GO-CFを試してみる
 
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
Automate Oracle database patches and upgrades using Fleet Provisioning and Pa...
 
ServiceMix 4 -- Integrating OSGi with JBI
ServiceMix 4 -- Integrating OSGi with JBIServiceMix 4 -- Integrating OSGi with JBI
ServiceMix 4 -- Integrating OSGi with JBI
 
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache TuscanyApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
 
Solaris 10 Advanced Features.
Solaris 10 Advanced Features.Solaris 10 Advanced Features.
Solaris 10 Advanced Features.
 
UKOUG Tech17 - Stay Secure With Oracle Solaris
UKOUG Tech17 - Stay Secure With Oracle SolarisUKOUG Tech17 - Stay Secure With Oracle Solaris
UKOUG Tech17 - Stay Secure With Oracle Solaris
 
Automated Java Deployments With Rpm
Automated Java Deployments With RpmAutomated Java Deployments With Rpm
Automated Java Deployments With Rpm
 
Bundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPMBundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPM
 
OpenStack Murano introduction
OpenStack Murano introductionOpenStack Murano introduction
OpenStack Murano introduction
 
SIP Router Project
SIP Router ProjectSIP Router Project
SIP Router Project
 
How to Configure the CA Workload Automation System Agent agentparm.txt File
How to Configure the CA Workload Automation System Agent agentparm.txt FileHow to Configure the CA Workload Automation System Agent agentparm.txt File
How to Configure the CA Workload Automation System Agent agentparm.txt File
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 

Saltstack for Ansible users

  • 1. Salt for Ansible Users Paul Traylor Fukuoka SRE Meetup #2 2019/10/12 1 / 19
  • 2. Introduction LINE Fukuoka Server Observability Team Providing tools for developers to increase their development velocity Promgen - Prometheus management tool https://github.com/line/promgen Prometheus as a Service Grafana as a Service Sentry as a Service https://linefukuoka.co.jp/ja/career/list/engineer/Monitoring_System 2 / 19
  • 3. Agenda What is Salt ? Salt intro for Ansible users Salt for automating (almost) everything 3 / 19
  • 4. What is Salt ? Salt is a new approach to infrastructure management built on a dynamic communication bus. Salt can be used for data-driven orchestration, remote execution for any infrastructure, configuration management for any app stack, and much more. https://docs.saltstack.com/en/latest/ 4 / 19
  • 5. Salt Intro - Master + Minion By default, Salt uses a Client/Server model Minions are authenticated using RSA keys Commands and Results are sent over ZeroMQ by default https://docs.saltstack.com/en/getstarted/overview.html 5 / 19
  • 6. Salt Intro - SSH Mode Salt also supports an SSH mode which is similar to Ansible https://docs.saltstack.com/en/getstarted/overview.html 6 / 19
  • 7. Salt Intro - Master Running commands is similar to Ansible # salt <target> <command> <args> salt '*' test.version salt 'web*' pkg.install nginx salt 'database*' state.apply mysql.server test=True 7 / 19
  • 8. Salt Intro - Minion But you can also run the same commands on the minion directly This is super userful for testing and debugging salt-call test.version salt-call pkg.install nginx salt-call state.apply mysql.server test=True 8 / 19
  • 9. Salt Intro - States Salt states look similar to Ansible playbooks States are rendered as Jinja and then loaded as Yaml /etc/foo.conf: file.managed: - source: - salt://foo.conf.{{ grains['fqdn'] }} - salt://foo.conf.fallback - user: foo - group: users - mode: 644 - attrs: i - backup: minion https://docs.saltstack.com/en/latest/ref/states/all/salt.states.file.html 9 / 19
  • 10. Salt Intro - States There is no distinction between playbooks and roles, everything is a state include: - nginx /etc/nginx/conf.d/example.conf: file.managed: - source: salt://example/example.conf - template: jinja 10 / 19
  • 11. Salt Intro - Pillars and Grains Ansible precidence always confuses me. https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html command line values (eg “-u user”) role defaults [1] inventory file or script group vars [2] inventory group_vars/all [3] playbook group_vars/all [3] inventory group_vars/* [3] playbook group_vars/* [3] inventory file or script host vars [2] inventory host_vars/* [3] playbook host_vars/* [3] host facts / cached set_facts [4] play vars play vars_prompt play vars_files role vars (defined in role/vars/main.yml) block vars (only for tasks in block) task vars (only for the task) include_vars set_facts / registered vars role (and include_role) params include params extra vars (always win precedence) 11 / 19
  • 12. Salt Intro - Pillars and Grains Pillars come from the salt-master and are for cluster level or secrets Grains come from the target machine, and are used for things like OS version, CPU count, memory, etc Salt gives you flexibility to handle variables how you want # Import from other files {% import_yaml "myfile.yml" as myfile %} {% import_json "defaults.json" as defaults %} {% import_text "completeworksofshakespeare.txt" as poems %} {{defaults.port}} # Read from Grains or Pillars {{salt['grains.get']('fqdn')}} {{salt['pillar.get']('role')}} # or write your own module {{ salt['vars.get']('example:db:password')}} https://docs.saltstack.com/en/latest/ref/renderers/all/salt.renderers.jinja.html 12 / 19
  • 13. Salt for automating - Plugable https://docs.saltstack.com/en/getstarted/system/plugins.html 13 / 19
  • 14. Salt for automating Salt is a new approach to infrastructure management built on a dynamic communication bus. Salt can be used for data-driven orchestration, remote execution for any infrastructure, configuration management for any app stack, and much more. The dynamic communication bus and well defined plugable architecture makes Salt significantly more powerful than ansible https://docs.saltstack.com/en/latest/ 14 / 19
  • 15. Salt for Automating - Returners Returns provide Salt with a flexibile system for sending the output of jobs into any system imagionable mysql elasticsearch kafka mongodb slack https://docs.saltstack.com/en/getstarted/overview.html https://docs.saltstack.com/en/latest/ref/returners/ 15 / 19
  • 16. Salt for Automating - Reactors Salt can react to various events within your system reactor: - 'salt/minion/*/start': - /srv/reactor/start.sls - /srv/reactor/monitor.sls - 'salt/cloud/*/destroyed': - /srv/reactor/destroy/*.sls - 'myco/custom/event/tag': - salt://reactor/mycustom.sls https://docs.saltstack.com/en/getstarted/overview.html https://docs.saltstack.com/en/latest/topics/reactor/ 16 / 19
  • 17. Salt for Automating - Engines Salt engines can be used to accept or process internal or external events engines: - webhook: port: 8000 address: 10.128.1.145 ssl_crt: /etc/pki/tls/certs/localhost.crt ssl_key: /etc/pki/tls/certs/localhost.key - slack: token: 'xoxb-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx' control: True fire_all: False - docker_events: docker_url: unix://var/run/docker.sock filters: event: - start - stop - die - oom https://docs.saltstack.com/en/latest/topics/engines/index.html 17 / 19
  • 18. Salt for Automating - Automate Github Deployments # salt-master configuration # Load a simple webhook so that we can easily map GitHub webhooks engines: - webhook: {} reactor: - 'salt/engines/hook/github': - salt://_reactor/autodeploy.sls #!yaml|github # salt://_reactor/autodeploy.sls line/promgen: # Whenever we update Promgen refs/heads/master: # we want to deploy the master branch deploy-promgen-web: local.state.sls: # by applying a salt state - tgt: role:promgen # matching our promgen servers - tgt_type: pillar - args: - mods: promgen.web - ret: slack # and let me know the result on slack https://github.com/kfdm/salt-deployhook 18 / 19