How to Speed Up Ansible Playbooks Over 600%

  Рет қаралды 17,996

Percy Grunwald from TopTechSkills

Percy Grunwald from TopTechSkills

Күн бұрын

Пікірлер: 63
@toptechskills
@toptechskills 8 ай бұрын
G'day everyone, if you're currently learning Ansible and want to see how all these modules fit together to build something useful, please consider checking out my course and letting me know what you think! It's currently in "early access" while I finish off the last chapter, and the first part of the course is free so you can try it out: learn.toptechskills.com/courses/productive-with-ansible. Thanks for all your support and happy coding!
@amizednix
@amizednix 3 жыл бұрын
It's 2021 and this is still so useful and helpful! Great videos.
@toptechskills
@toptechskills 3 жыл бұрын
Thank you Amin, very glad it's still useful for you. I know molecule has changed a bit since the recording, but I hope people are able to get what they need to get started from this video.
@dhir_AND
@dhir_AND 4 жыл бұрын
Exactly what I was looking for. Well demonstrated !!
@toptechskills
@toptechskills 4 жыл бұрын
Glad the video was what you were looking for, thank you for your kind comment 🙏
@bab333bab
@bab333bab 4 жыл бұрын
Awesome video! Voice, presentation and comparison are perfect, thank you very much!
@toptechskills
@toptechskills 4 жыл бұрын
You're very welcome, thanks for your kind comment 🙏
@jayeshdhale2226
@jayeshdhale2226 4 жыл бұрын
Percy This is one of awesome video series of ansible I ever come across, Awesome
@toptechskills
@toptechskills 4 жыл бұрын
Thank you for your kind comment jayesh dhale, glad it was useful for you.
@toptechskills
@toptechskills 5 жыл бұрын
Thanks for watching everyone, I hope you found the video useful! Here's the link to the full article, if you want to check out the detailed benchmarks: bit.ly/2Slzbpa Please comment if you have any questions or feedback.
@hprangana
@hprangana 3 жыл бұрын
thanks a lot. it helped me a lot
@binaryfire
@binaryfire 2 ай бұрын
Great video, thanks! Is there a benefit to using both "pipelining = true" and "strategy = mitogen_linear" at the same time?
@toptechskills
@toptechskills 2 ай бұрын
Great question, _in theory_ pipelining should affect any ssh-based connection plugin, including Ansible's default ssh connection plugin and maybe mitogen too, since it's based on ssh. So yeah, in theory I think there could be some effect, but I didn't test it, so I would be curious to see your results if you end up testing it!
@alexevinson5267
@alexevinson5267 5 жыл бұрын
Thanks for sharing really good stuff, Percy, your tutorials are extremely useful and very well done! I wish you to grow your channel up to 200k subscribers at least, just because you deserve :) By the way, Ansible playbooks can run even faster with asynchronous mode in tasks (especially multiple asynchronous tasks running concurrently), highest number of forks set, and with facts and connection caching enabled, but the last option is for the huge number of hosts to be served at once. Give it a try!
@toptechskills
@toptechskills 5 жыл бұрын
Hi Alex, thanks so much for those great suggestions. I actually wasn't aware of inventory or fact caching, these could help a lot!
@italiouine8909
@italiouine8909 4 жыл бұрын
what command to display (4:21)
@toptechskills
@toptechskills 4 жыл бұрын
Hi Brahim, the window at 4:21 is `iTerm` (www.iterm2.com/) and I have divided the window vertically 3 times with the "Shell > Split vertically" option. Hope that helps, thanks for your comment.
@lvlupdev
@lvlupdev 3 жыл бұрын
Hi Percy, thank you very much, you solved a 10-hours problem in 7 minutes.
@toptechskills
@toptechskills 3 жыл бұрын
Awesome, really happy to hear that! Thanks for the comment 🙏
@ashokpj3807
@ashokpj3807 4 жыл бұрын
Your channel videos are very useful.
@toptechskills
@toptechskills 4 жыл бұрын
So happy the videos are useful for you, thank you for your comment 🙏
@dialaraBilbob
@dialaraBilbob 4 жыл бұрын
hi, does it matter whichpath you extract the tar file? I extracted and move it to /etc/ansible directory ,when I change ansible.cfg strategy=mitogen_linear, and run playbook it gives error.
@toptechskills
@toptechskills 4 жыл бұрын
Hi Dilara, it should not matter where the files are stored, but I think you still might need to set the `strategy_plugins` option to the correct path: ``` # ansible.cfg [defaults] strategy_plugins = /path/to/mitogen-0.2.5/ansible_mitogen/plugins/strategy strategy = mitogen_linear ``` Hope that helps!
@enneydee
@enneydee 4 жыл бұрын
Hi Percy, have you tried using "strategy = mitogen_free"? Is there a great difference with the default config "strategy = mitogen_linear"? Please provide insights. Thank you!
@toptechskills
@toptechskills 4 жыл бұрын
I generally stick with the default strategy for Ansible (linear) regardless of the connection plugin (ssh, mitogen, etc.) The `linear` (and `mitogen_linear`) strategy both wait for all hosts to complete each task before moving on to the next task, whereas `free` (and `mitogen_free`) will execute tasks as fast as possible on all hosts without waiting for slower hosts. To me, the free strategy is harder to reason about and if you look at your playbook overall, it's not actually going to complete any faster, since your playbook is still going to complete as fast as your _slowest_ host anyway. Some of your hosts might be finished more quickly, but your playbook won't complete until the slowest host is done, so you still need to wait the same length of time. The linear strategy also allows you to deal with hosts that have a dependency on each other, e.g. you want to know that a process has stopped on all hosts in the play before changing the configuration. With the linear strategy, you can know with certainty that when you start a task on any host, that all other hosts in the play have completed the previous task and are at the same stage. All in all, I don't see much value in the `free` strategy. docs.ansible.com/ansible/latest/user_guide/playbooks_strategies.html
@printjunkee
@printjunkee 5 жыл бұрын
Hi Percy, thanks for sharing this. Could you please tell me if can use both pipelining and mitogen plugin together, i.e. in the same configuration file. Also, would it better to just use mitogen plugin or both pipelining and mitogen together to speed up the playbook?
@toptechskills
@toptechskills 5 жыл бұрын
Hi Harshit Chawla, great question, from my understanding the pipelining setting should have no effect on mitogen, but I could be wrong. I will need to try it out later. I know that mitogen operates over most of the transport plugins by establishing a connection to a python agent. In theory, pipelining should have no effect on this. You might want to try enabling and disabling pipelining when using mitogen and see what the results are, I expect there will be no difference.
@printjunkee
@printjunkee 5 жыл бұрын
​@@toptechskills Yes you are right, I tried enabling and disabling pipelining with mitogen and there was no difference in the results.
@enneydee
@enneydee 4 жыл бұрын
This is my current setup and it doesnt hurt. Makes no upfront noticable difference. What I'd like to know is if someone has tried using "strategy = mitogen_free"...? [defaults] gather_timeout = 30 strategy_plugins = /usr/local/mitogen/ansible_mitogen/plugins/strategy strategy = mitogen_linear callback_whitelist = timer, profile_tasks [ssh_connection] pipelining = True
@veejeyz
@veejeyz 4 жыл бұрын
Hi @Percy.. The contents you teach are extremely helpful and I'd love if you could make one to better understand the deploy_helper module in ansible? Thanks again!!!!
@toptechskills
@toptechskills 4 жыл бұрын
Thanks for the heads up about `deploy_helper`, I hadn't seen that module before but it looks super useful. Thanks again for the comment 🙏
@infantusgodfrey967
@infantusgodfrey967 4 жыл бұрын
My controller is centos7 and when connecting with ubuntu16 it shows the following issue as ubuntu16 has ansible_python_interpreter=/usr/bin/python3 EOF on stream; last 100 lines received: ansible@192.168.0.105's password: bash: /usr/bin/python: No such file or directory
@toptechskills
@toptechskills 4 жыл бұрын
I have an article for something similar (www.toptechskills.com/ansible-tutorials-courses/how-to-fix-usr-bin-python-not-found-error-tutorial/), but it looks like your issue is slightly different. Can you share the playbook?
@mikecmw8492
@mikecmw8492 5 жыл бұрын
Hi, do you have any ansible videos showing how to use the cron module? Need help trying to get this to work.
@toptechskills
@toptechskills 5 жыл бұрын
Hi Mike, unfortunately I haven't had time to record a video for the cron module yet. What's the problem you're having? I'm happy to help you get it working.
@mikecmw8492
@mikecmw8492 5 жыл бұрын
@@toptechskills the interesting part is I got it working. I did not realize how easy the cron module is to use. Been starting ansible last month or two. There are some hangups. Maybe I will ask as I get to them. I will watching your videos going forward. Thanks
@toptechskills
@toptechskills 5 жыл бұрын
@@mikecmw8492 great that you got it working. I find the best way to get familiar with a new module is to look at the example commands at the bottom of the module docs on docs.ansible.com. If you run into any roadblocks feel free to hit me up at percy@toptechskills.com. Good luck!
@tjwatts100
@tjwatts100 2 жыл бұрын
Amazing. I'm.going to test mitogen at work
@sandeeputb
@sandeeputb 5 жыл бұрын
Thanks for your video. Can u tell me the ide name u are using for yml.
@toptechskills
@toptechskills 5 жыл бұрын
Hi Sandeep, my editor is VS Code (code.visualstudio.com/). Highly recommend this editor as your IDE.
@boopathi.kkanagaraj9055
@boopathi.kkanagaraj9055 2 жыл бұрын
does mitogen work for windows hosts
@toptechskills
@toptechskills 2 жыл бұрын
No, I don't think so
@compumatterllc
@compumatterllc 3 жыл бұрын
Ecstatic I stumbled upon this post. I have a very wide variety of tasks being run including downloads, software installs, apache and nginx server setups and much more. So it's a lot more complex than just a few text-oriented tasks. My results were not where near as impressive: Only a 40 second improvement. With pipelining turned on in both cases, it took my sizeable playbook down from: * Playbook run took 0 days, 0 hours, 10 minutes, 0 seconds TO * Playbook run took 0 days, 0 hours, 9 minutes, 20 seconds Do you know of a way to debug / troubleshoot this? Wondering if Mitogen is actually working. Followed your instructions to a 'T'
@toptechskills
@toptechskills 3 жыл бұрын
I have more details in the article I wrote that the video is based on: www.toptechskills.com/ansible-tutorials-courses/speed-up-ansible-playbooks-pipelining-mitogen/#initial-run. In this section I showed that there was little time benefit of mitogen vs pipelining for the _initial_ run of Ansible for a given set of roles. I hypothesize that this is primarily due to the fact that most of the time in the initial run of the playbook is spent actually doing the installation tasks, rather than in "Ansible overhead". In subsequent runs, and in runs on hosts where the ping is high, "Ansible overhead" forms a bigger portion of the overall runtime. Since mitogen primarily reduces the time associated with overhead, but does nothing to speed up the actual tasks (i.e. running "apt install" will be just as fast regardless of whether you did it with mitogen or pipelining). I'm assuming in your case that your results are from a "fresh" run of a playbook (i.e. none of the software is installed already), the ping to the server is very low or it's running locally. In all of those cases I would expect the overhead to be low and for mitogen to give only limited improvements.
@jaylepore5420
@jaylepore5420 3 жыл бұрын
@@toptechskills Thanks for the write back. Yes, of little value from what I've experienced on my initial run. Will try it again on the update side of life and see how it goes. Thanks.
@ramodhyarathnayake8035
@ramodhyarathnayake8035 5 жыл бұрын
Awesome Teaching. Great Video, Please do more videos about Ansible. Thanks
@toptechskills
@toptechskills 5 жыл бұрын
Thanks for your kind comment Ramodhya Rathnayake, very happy you enjoyed it and I will release more videos in future.
@AnCacaMilis
@AnCacaMilis 5 жыл бұрын
Great vid. Very concise
@toptechskills
@toptechskills 5 жыл бұрын
Thanks for your comment @AnCacaMilis, glad you enjoyed it.
@sidweb3.2
@sidweb3.2 4 жыл бұрын
Great video Percy! May I know which tool are you using to parallelly writing + executing the yml in single window ??
@toptechskills
@toptechskills 4 жыл бұрын
Hi Sidharth paul, I'm using Visual Studio Code as my editor (code.visualstudio.com/) with the built-in terminal. I'm a big fan of this editor, hope you can give it a go. Thanks a lot for your comment.
@ts-vq7gc
@ts-vq7gc 3 жыл бұрын
thanks! great video
@toptechskills
@toptechskills 3 жыл бұрын
You're welcome, hope it was helpful, thank you for your comment 🙏
@narasimhangopinath1559
@narasimhangopinath1559 5 жыл бұрын
Thanks a lot bro.. Mitogen works cool 👍
@toptechskills
@toptechskills 5 жыл бұрын
Thanks Narasimhan Sargur, I hope it improves your Ansible performance!
@ahsan-li7sh
@ahsan-li7sh 5 жыл бұрын
Great video
@toptechskills
@toptechskills 5 жыл бұрын
Thank you for watching Ahsan!
@johnclarkon369
@johnclarkon369 4 жыл бұрын
Thx. Nfs
@account-pending-deletion
@account-pending-deletion 4 жыл бұрын
what kind of madman uses vs code in any color theme other than Monokai Dimmed? especially a LIGHT theme? what the actual hell, man
@toptechskills
@toptechskills 4 жыл бұрын
Haha, I did some experiments before making videos and found that dark text on a light background is easier to read at small sizes or when compressed, the contrast seemed better to me. When viewing the video minimized or on a phone screen it was clearer.
@DaVince21
@DaVince21 4 жыл бұрын
Hey now, bright themes are excellent when you're doing coding in your backyard!
@DaVince21
@DaVince21 4 жыл бұрын
Seven ex? The x stands for times, you know. :P Anyway, thanks for this informative video, this is helping our team make decisions with regards to pipelining.
@toptechskills
@toptechskills 4 жыл бұрын
Thanks for the comment, glad the information was helpful for you and your team.
Ansible: Read remote files into variables with the Slurp module (+ alternatives)
10:04
Percy Grunwald from TopTechSkills
Рет қаралды 1,2 М.
Ansible File Module Tutorial - Complete Beginner's Guide
15:20
Percy Grunwald from TopTechSkills
Рет қаралды 28 М.
Vampire SUCKS Human Energy 🧛🏻‍♂️🪫 (ft. @StevenHe )
0:34
Alan Chikin Chow
Рет қаралды 138 МЛН
Jaidarman TOP / Жоғары лига-2023 / Жекпе-жек 1-ТУР / 1-топ
1:30:54
Война Семей - ВСЕ СЕРИИ, 1 сезон (серии 1-20)
7:40:31
Семейные Сериалы
Рет қаралды 1,6 МЛН
Buying a Cheap SSD for a Gaming PC? 🤔
1:01
Zach's Tech Turf
Рет қаралды 145 М.
Things I wish I knew about Ansible from day 1
10:58
Michael Crilly
Рет қаралды 7 М.
How programmers flex on each other
6:20
Fireship
Рет қаралды 2,6 МЛН
Ansible Command Module Tutorial - Complete Beginner's Guide
10:11
Percy Grunwald from TopTechSkills
Рет қаралды 13 М.
Rapidly Build & Test Ansible Roles with Molecule + Docker
20:58
Percy Grunwald from TopTechSkills
Рет қаралды 32 М.
Ansible - Picking up speed with Mitogen
4:15
R3ap3rPy
Рет қаралды 1,3 М.
Ansible Advanced Template Loops Tutorial - Use Loop Vars in Your Templates
7:49
Percy Grunwald from TopTechSkills
Рет қаралды 27 М.
you need to learn Ansible RIGHT NOW!! (Linux Automation)
21:21
NetworkChuck
Рет қаралды 907 М.
Ansible Copy Module Tutorial - Complete Beginner's Guide
10:42
Percy Grunwald from TopTechSkills
Рет қаралды 18 М.
Ansible best practices for startups to enterprises
58:45
Red Hat Summit
Рет қаралды 65 М.
Vampire SUCKS Human Energy 🧛🏻‍♂️🪫 (ft. @StevenHe )
0:34
Alan Chikin Chow
Рет қаралды 138 МЛН