Salt–AScalableSystems … · Salt–Introduction...
Transcript of Salt–AScalableSystems … · Salt–Introduction...
![Page 1: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/1.jpg)
Salt – A Scalable SystemsManagement Solution for DatacentersOpen Source Data Center Conference April 26-28, 2016
Sebastian MeyerLinux Consultant & Trainer
B1 Systems [email protected]
B1 Systems GmbH - Linux/Open Source Consulting, Training, Support & Development
![Page 2: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/2.jpg)
Introducing B1 Systems
founded in 2004operating both nationally and internationallynearly 100 employeesprovider for IBM, SUSE, Oracle & HPvendor-independent (hardware and software)focus:
consultingsupportdevelopmenttrainingoperationssolutions
B1 Systems GmbH Salt – Scalable Systems Management 2 / 47
![Page 3: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/3.jpg)
Areas of Expertise
B1 Systems GmbH Salt – Scalable Systems Management 3 / 47
![Page 4: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/4.jpg)
Salt – Introduction
B1 Systems GmbH Salt – Scalable Systems Management 4 / 47
![Page 5: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/5.jpg)
Yet Another Systems Management Solution?
takes inspiration from Puppet, Chef or Ansiblefocuses on the entire system life cycleeasily scalable to a few thousand systemsconvenient and easy to learnconfiguration management and remote execution
B1 Systems GmbH Salt – Scalable Systems Management 5 / 47
![Page 8: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/8.jpg)
Scalability: Masters, Syndics & Minions
B1 Systems GmbH Salt – Scalable Systems Management 8 / 47
![Page 9: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/9.jpg)
High Availability: Multiple Masters& Minions
B1 Systems GmbH Salt – Scalable Systems Management 9 / 47
![Page 10: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/10.jpg)
Salt Modes
minions pull from mastermaster pushes to Minionsminions apply states locallymaster applies states on minions via SSH
B1 Systems GmbH Salt – Scalable Systems Management 10 / 47
![Page 11: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/11.jpg)
Remote Execution System
B1 Systems GmbH Salt – Scalable Systems Management 11 / 47
![Page 14: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/14.jpg)
Configuration Management
B1 Systems GmbH Salt – Scalable Systems Management 14 / 47
![Page 15: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/15.jpg)
States
ID:module.function:
- name: name- argument1: value- argument2:
- value1- value2
B1 Systems GmbH Salt – Scalable Systems Management 15 / 47
![Page 16: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/16.jpg)
Top File
base:’*’:
- monitoring- ssh- syslog
’*lan*’:- ntp.lan
’*dmz*’:- ntp.dmz- firewall
all servers:monitoringssh configsyslog
servers in LAN:ntp config
servers in DMZ:ntp configfirewall
B1 Systems GmbH Salt – Scalable Systems Management 16 / 47
![Page 18: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/18.jpg)
Pillar Data
Pillar Examplentp:
{% if grains[’id’].startswith(’myntpserver’) %}ntpservers: ["0.us.pool.ntp.org","1.us.pool.ntp.org"]comment: ’’{% else %}ntpservers: ["10.1.1.20","10.1.1.21"]comment: ’myinternalservers’{% endif %}
Source: https://github.com/saltstack-formulas/ntp-formula/blob/master/pillar.example
B1 Systems GmbH Salt – Scalable Systems Management 18 / 47
![Page 19: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/19.jpg)
Pillars and States
States top.slsbase:
’*’:- monitoring- ssh- syslog- ntp
’*dmz*’:- firewall
Pillar top.slsbase:
’*’:- monitoring- ssh- syslog
’*lan*’:- ntp.lan
’*dmz*’:- ntp.dmz- firewall
B1 Systems GmbH Salt – Scalable Systems Management 19 / 47
![Page 20: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/20.jpg)
Deploying the State
Master pushes to minionssalt ’*’ state.highstatesalt ’*’ state.sls mystate
Minions pull from mastersalt-call state.highstatesalt-call state.sls mystate
B1 Systems GmbH Salt – Scalable Systems Management 20 / 47
![Page 21: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/21.jpg)
Reusing States: Formulas
reusing existing coderoughly the same as Puppet modules/Ansible rolescollection of States and filesgithub.com/saltstack-formulas/ for "official" formulas
B1 Systems GmbH Salt – Scalable Systems Management 21 / 47
![Page 22: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/22.jpg)
Using Formulas
directly from VCS or localextendable via includeconfigurable via Pillar datavariables mapped via Jinja maprequirements across Formulas possible
B1 Systems GmbH Salt – Scalable Systems Management 22 / 47
![Page 24: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/24.jpg)
Returners
salt ’*’ disk.usage --return redis_return
B1 Systems GmbH Salt – Scalable Systems Management 24 / 47
![Page 25: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/25.jpg)
Salts Event Driven Infrastructure
B1 Systems GmbH Salt – Scalable Systems Management 25 / 47
![Page 26: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/26.jpg)
Overview
actions trigger eventsevents are communicated via the event busreactors execute trigger actions responding to events
B1 Systems GmbH Salt – Scalable Systems Management 26 / 47
![Page 28: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/28.jpg)
Actions & Events
master# salt ’salt-minion-01’ disk.percent /srvsalt-minion-01:
11%
B1 Systems GmbH Salt – Scalable Systems Management 28 / 47
![Page 29: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/29.jpg)
Actions & Events20160422163250339970 {
[...]}salt/job/20160422163250339970/new {
"_stamp": "2016-04-22T14:32:50.340357","arg": [ "/srv" ],"fun": "disk.percent","jid": "20160422163250339970","minions": [ "salt-minion-01" ],"tgt": "salt-minion-01","tgt_type": "glob","user": "root"
}
B1 Systems GmbH Salt – Scalable Systems Management 29 / 47
![Page 30: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/30.jpg)
Actions & Events
salt/job/20160422163250339970/ret/salt-minion-01 {"_stamp": "2016-04-22T14:32:50.536877","cmd": "_return","fun": "disk.percent","fun_args": [ "/srv" ],"id": "salt-minion-01","jid": "20160422163250339970","retcode": 0,"return": "11%","success": true
}
B1 Systems GmbH Salt – Scalable Systems Management 30 / 47
![Page 31: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/31.jpg)
Events in a State
b1/mystate/status/update:event.send:
- data:status: "Installation done!"
B1 Systems GmbH Salt – Scalable Systems Management 31 / 47
![Page 32: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/32.jpg)
Beacons
hook into system on minioncreate eventsinotify, diskusage, load, journald ...
B1 Systems GmbH Salt – Scalable Systems Management 32 / 47
![Page 33: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/33.jpg)
Beacons - Example
inotify Beaconbeacons:
inotify:/etc/motd:
mask:- modify
B1 Systems GmbH Salt – Scalable Systems Management 33 / 47
![Page 35: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/35.jpg)
Calling Reactors on Events
Reactor Examplereactor:
- ’salt/minion/*/start’:- /srv/reactor/start.sls
- ’b1/mystate/status/*’:- salt://reactor/status.sls
B1 Systems GmbH Salt – Scalable Systems Management 35 / 47
![Page 37: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/37.jpg)
Use Cases?
load-balancingjob automationalerting
B1 Systems GmbH Salt – Scalable Systems Management 37 / 47
![Page 40: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/40.jpg)
Providers
Amazon EC2 Provider Examplemy-ec2:
driver: ec2id: ’MYEC2ID’key: ’adsfrf453fMYKEYasdsadg43’private_key: /etc/salt/my_key.pemkeyname: my_keysecuritygroup: defaultminion:
master: saltmaster.example.com
B1 Systems GmbH Salt – Scalable Systems Management 40 / 47
![Page 41: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/41.jpg)
Profiles
profile nameproviderimage or templateoptions for the instanceminion options
B1 Systems GmbH Salt – Scalable Systems Management 41 / 47
![Page 42: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/42.jpg)
Profiles
LXC Profile Examplemyfancyprofile:
provider: lxc-host01lxc_profile:
template: ubuntuoptions:
release: trustypassword: test123
B1 Systems GmbH Salt – Scalable Systems Management 42 / 47
![Page 43: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/43.jpg)
Maps
Mapfileprofile1:
- instance_name_1- instance_name_2
profile2:- instance_name_3:
grains:mykey: myvalue
- instance_name_4
Execute Mapfilesalt-cloud -m /path/to/mapfile
B1 Systems GmbH Salt – Scalable Systems Management 43 / 47
![Page 44: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/44.jpg)
Bootstrapping a New Salt Environment
Mapfileprofile1:
- instance_name_1:make_master: Trueminion:
master: myoldmasterlocal_master: True
- instance_name_2- instance_name_3- instance_name_4
...
B1 Systems GmbH Salt – Scalable Systems Management 44 / 47
![Page 45: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/45.jpg)
Saltify Existing Machines 1/2
Saltify Providersaltify-all-machines:
driver: saltifyminion:
master: mysaltmaster
Saltify Profilesalt-machine:
provider: saltify-all-machinesssh_username: rootkey_filename: ’/etc/salt/pki/master/ssh/salt-ssh.rsa’
B1 Systems GmbH Salt – Scalable Systems Management 45 / 47
![Page 46: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/46.jpg)
Saltify Existing Machines 2/2
Mapfilesalt-machine:
- first-machine:ssh_host: 1.2.3.4
- second-machine:ssh_host: 1.2.3.5
- third-machine:ssh_host: 1.2.3.6
B1 Systems GmbH Salt – Scalable Systems Management 46 / 47
![Page 47: Salt–AScalableSystems … · Salt–Introduction B1SystemsGmbHSalt–ScalableSystemsManagement4/47. YetAnotherSystemsManagementSolution? ... github.com/saltstack-formulas/for"official"formulas](https://reader031.fdocuments.net/reader031/viewer/2022022015/5b5b738f7f8b9a302a8e01a3/html5/thumbnails/47.jpg)
Thank You!
For more information, refer to [email protected] +49 (0)8457 - 931096
B1 Systems GmbH - Linux/Open Source Consulting, Training, Support & Development