The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Automating deployments from GitHub using SaltStack
1. Automating deployments from GitHub using
SaltStack
Paul Traylor
LINE Fukuoka
2018/12/10
LINE Developer Meetup #47 in Fukuoka
1 / 14
2. What is SaltStack?
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/getstarted/overview.html
https://docs.saltstack.com/en/getstarted/images/basic-comm.png
2 / 14
3. What is SaltStack? - Events
https://docs.saltstack.com/en/getstarted/images/reactor.png
3 / 14
5. What is SaltStack? - Reactor
https://docs.saltstack.com/en/latest/topics/reactor/
reactor: # Master config section "reactor"
- 'salt/minion/*/start': # Match tag "salt/minion/*/start"
- /srv/reactor/start.sls # Things to do when a minion starts
- /srv/reactor/monitor.sls # Other things to do
- 'salt/cloud/*/destroyed': # Globs can be used to match tags
- /srv/reactor/destroy/*.sls # Globs can be used to match file names
- 'myco/custom/event/tag': # React to custom event tags
- salt://reactor/mycustom.sls # Reactor files can come from the salt fileserver
5 / 14
6. What is SaltStack? - Returners
https://docs.saltstack.com/en/getstarted/images/returners.png
6 / 14
7. What is SaltStack? - Returners
http://docs.saltstack.com/en/latest/ref/returners/
elasticsearch
kafka
mongo
mysql
postgres
redis
...
7 / 14
8. How do we use this ?
Events
Returners
Reactors
8 / 14
9. Events - Enable Webhooks
# salt-master configuration
# Load a simple webhook so that we can easily map GitHub webhooks
# to our salt state
engines:
- webhook: {}
http://docs.saltstack.com/en/latest/ref/engines/all/salt.engines.webhook.html
9 / 14
10. Events - GitHub Webhooks
Post to our Salt Master will fire an event
curl -X POST http://salt.example.com/github <<EOF
{webhook json body}
EOF
is put onto the Salt event bus
salt/engines/hook/github {webhook json body}
10 / 14
11. Reactors - Map our event to a reactor
# salt-master configuration
reactor:
- 'salt/engines/hook/github':
- salt://_reactor/autodeploy.sls
11 / 14
12. Reactors - Write our Reactor
#!yaml|github
# salt://_reactor/autodeploy.sls
# Whenever we update Promgen
line/promgen:
# we want to deploy the master branch
refs/heads/master:
deploy-promgen-web:
# by applying a salt state
local.state.sls:
# matching our promgen servers
- tgt: role:promgen
- tgt_type: pillar
- args:
- mods: promgen.web
# and let me know the result on slack
- ret: slack
https://github.com/kfdm/salt-deployhook
12 / 14
13. What is SaltStack ?
Events
Returners
Reactors
Automate your infrastructure
13 / 14