Running Ansible within Salt How to smoothly migrate away from Ansible to Salt Pablo Suárez Hernández Don Vosburg SUSE Senior Software Engineer SUSE Technology Specialist psuarezhernandez@suse.com dvosburg@suse.com
People are using Ansible out there! 2
People are running Ansible out there! ● Customer’s IT infrastructure already defined with Ansible ● Efforts already invested. Security audit. ● Ansible modules and playbooks all over the places. 3
… and they always face the same problems! ● Real-time monitoring ● Event-driven Orchestration ● Scalability 4
Salt enables you! Let’s put Salt in your IT. ● Real-time monitoring → beacons! ● Event-driven Orchestration → reactors! ● Scalability → zeromq, syndics! 5
But wait! We have a problem! 6
But wait! We have a problem! ● Customer IT infrastructure already defined with Ansible ● Efforts already invested. Security audit. ● Ansible modules and playbooks all over the place. No way of a smooth, step-by-step, planned migration. Only the hard way. UNTIL NOW! 7
Don’t panic! 8
What would happen if ... we could just simply consider the whole Ansible as a subset of the functionality that Salt provides ? 9
Ansible Gate: Cooking Ansible with a bit of Salt ● New module in Salt 2019.2.0 “Fluorine” release ● An innovation coming from SUSE ● Execute Ansible modules from Salt ● Run your playbooks! 10
Ansible Gate: Cooking Ansible with a bit of Salt The Salt “Fluorine” release package is available in: ● SLE15 and SLE15SP1. Base system package ● OpenSUSE Leap 15/15.1, 42.3 and Tumbleweed ● “systemsmanagement:saltstack:products:next/salt” at OBS [1] [1] - https://build.opensuse.org/package/show/systemsmanagement:saltstack:products:next/salt 11
How does the Ansible Gate work? 12
How does the Ansible Gate work? ● Ma n a g e y o u r A n s i b l e f r o m S a l t ● E x e c u t e S a l t c o mma n d s o n y o u r A n s i b l e ma n a g e d s y s t e ms ( s a l t - ma s t e r & s a l t - s s h ) 13
How does the Ansible Gate work? # Some examples: # Ansible needs to be installed on the running system. $ salt-call --local ansible.list $ salt-call --local ansible.help system.ping $ salt-call --local ansible.system.ping data=”Hello from Salt” 14
How does the Ansible Gate work? # Some examples: # Ansible needs to be installed on “ansiblenode” minion. # Playbooks are already stored on the “ansiblenode” minion. $ salt “ansiblenode” ansible.system.ping $ salt “ansiblenode” ansible.packaging.os.zypper name=”iotop” state=”installed” $ salt “ansiblenode” ansible.playbook playbook=/srv/playbooks/install_nginx.yml 15
● Ma n a g e y o u r A n s i b l e f r o m S a l t ● E n a b l e s r e a l - t i me mo n i t o r i n g a n d e v e n t - d r i v e n o r c h e s t r a t i o n . ● A d d t h e wh o l e mi n i o n f u n c t i o n a l i t y t o t h e A n s i b l e ma n a g e d s y s t e ms . 16
Reusing the Ansible Inventory /etc/ansible/hosts susecon-fluorine-minion1.tf.local Susecon-fluorine-minion2.tf.local [webservers] # Example of running Salt commands susecon-fluorine-minion1.tf.local # on Ansible managed systems. [py3-hosts] susecon-fluorine-minion1.tf.local susecon-fluorine-minion2.tf.local [py3-hosts:vars] ansible_python_interpreter=/usr/bin/python3 $ salt-ssh --roster=ansible --roster-file=/etc/ansible/hosts -N all test.ping $ salt-ssh --roster=ansible --roster-file=/etc/ansible/hosts -N webservers service.stop apache2 17
How to smoothly migrate from Ansible to Salt 18
The common Ansible scenario A n s i b l e mo d u l e s ● P l a y b o o k s ● 19
Step 0: Adding just few grains of Salt 20
Adding some grains of Salt ... A n s i b l e mo d u l e s ● P l a y b o o k s ● E x e c u t e S a l t c o mma n d s ( s a l t - s s h ) o n A n s i b l e ● ma n a g e d s y s t e ms 21
Step 1: Salt makes it tasty! 22
Salt makes it tasty! R u n n i n g p l a y b o o k s a s S a l t j o b s . ● E x e c u t e A n s i b l e mo d u l e s o n t h e ● s a l t - mi n i o n s y s t e m. A n s i b l e mo d u l e s ● R u n n i n g p l a y b o o k s i n S L S fj l e s ! ● P l a y b o o k s ● E x e c u t e S a l t c o mma n d s ( s a l t - s s h ) o n A n s i b l e ma n a g e d ● s y s t e ms 23
N e w g r o wi n g S a l t ● ma n a g e d I T E v e n t - d r i v e n ● o r c h e s t r a t i o n o n a h y b r i d e n v i r o n me n t A n s i b l e mo d u l e s ● P l a y b o o k s ● E x e c u t e S a l t c o mma n d s ( s a l t - s s h ) o n ● A n s i b l e ma n a g e d s y s t e ms 24
Step 2: Spreading the Salt all over the place! 25
Ma n a g e y o u r l e g a c y A n s i b l e a s S a l t j o b s . ● R e a l - t i me mo n i t o r i n g a n d e v e n t - d r i v e n o r c h e s t r a t i o n i n a l l y o u r I T ( s a l t - mi n i o n ) ● T h e wh o l e mi n i o n f u n c t i o n a l i t y o n t h e o l d A n s i b l e ma n a g e d s y s t e ms . ● 26
Demo time! 27
Questions? 28
T h a n k Y o u !
31
Recommend
More recommend