Getting started with Ansible 06 – Writing our first Playbook
Ansible is an incredible configuration management and provisioning utility that enables you to automate all the things. In this series, you’ll learn everything you need to know in order to use Ansible for your day-to-day administration duties. In video #6, we get started on writing playbooks, which is how we’ll use Ansible from here on out.
Full series:
Part 1 (Introduction): https://linux.video/ansible1
Part 2 (SSH Overview & Setup): https://linux.video/ansible2
Part 3 (Setting up the Git Repository): https://linux.video/ansible3
Part 4 (Running Commands): https://linux.video/ansible4
Part 5 (Running Elevated Commands): https://linux.video/ansible5
Part 6 (This video)
Part 7 (The “when” Conditional): https://linux.video/ansible7
Part 8 (Improving your Playbook): https://linux.video/ansible8
Part 9 (Targeting Specific Nodes): https://linux.video/ansible9
Part 10 (Tags): https://linux.video/ansible10
Part 11 (Managing Files): https://linux.video/ansible11
Part 12 (Managing Services): https://linux.video/ansible12
Part 13 (Adding Users & Bootstrapping): https://linux.video/ansible13
Part 14 (Roles): https://linux.video/ansible14
Part 15 (Host Variables): https://linux.video/ansible15
Part 16 (Templates): https://linux.video/ansible16
🙌 Support me on Patreon and get early access to new content!
➡️ https://learnlinux.link/patron
☁️ Get $100 in credit toward deploying your very own Linux servers on Linode!
➡️ http://linode.com/learnlinuxtv
🛒 Affiliate store for Linux compatible hardware/accessories (commission earned):
➡️ https://learnlinux.link/amazon
💻 Check out the Tiny Pilot KVM for your Homelab (commission earned):
➡️ https://learnlinux.link/tinypilot
💻 Check out Shells.com and spin up your very own Linux or Windows desktop in the cloud (commission earned):
➡️ https://learnlinux.link/shells
Wiki article for this video:
https://www.learnlinux.tv/getting-started-with-ansible-06-writing-our-first-playbook/
🐦 Follow me on Twitter!
➡️ https://learnlinux.link/twitter
💬 Official LearnLinux.tv Community:
➡️ https://community.learnlinux.tv
📖 Check out my latest book, Mastering Ubuntu Server 3rd Edition. Available now!
➡️ https://ubuntuserverbook.com
👨 More about me:
➡️ https://www.jaylacroix.com
➡️ https://www.learnlinux.tv/about-me
💽 How to create a bootable flash drive for installing Linux:
➡️ https://linux.video/flash-usb
🐧 Which distro do I use?
➡️ https://learnlinux.link/mydistro
🔐 How to better secure OpenSSH:
➡️ https://linux.video/secure-ssh
☁️ How to create a cloud Linux server with Linode:
➡️ https://learnlinux.link/create-linode
#AnsiblePlaybook #Ansible #LearnAnsible
source
Leave us a comment Cancel reply
COMMON QUESTIONS
Categories
- Agile Coach
- ARTIFICIAL INTELLIGENCE
- Block chain
- Business Analyst BA
- DATA science
- Development
- Devops Automation
- Dotnet
- Education
- Free Job training and assistance
- Information
- Infrastructure automation
- Interview questions
- JAVA
- jobs
- Learn
- Machine learning
- Python Automation
- QA Automation
- RPA Automation
- SAP crm
- Scrum master Agile
- Skill
- UI Design
- Uncategorized
34 Comments
Debashish Choudhuri
May 12, 2022 00:45 amlegit content – well done and well presented
krishna rawat
May 12, 2022 00:45 amYou are so awesome. Thanks for the video
kodi kodi
May 12, 2022 00:45 amthis is a really great series. i never thought i could get this kind of quality instruction on youtube.
foosfighter
May 12, 2022 00:45 amWhat is this become password?
Langalafa Oriho
May 12, 2022 00:45 amI need more assistance learning ansible
Hung Nguyen
May 12, 2022 00:45 amFor the amount of videos that I have been watching, none is better than Jay's. Bless you and your family.
Bashar Dlaleh
May 12, 2022 00:45 amplaying your videos in 1.25 speed is perfect
Reza SadriNia
May 12, 2022 00:45 amWhat is the name of the bar at the bottom of tmux?
Bob A.
May 12, 2022 00:45 amThanks Jay
George Smith
May 12, 2022 00:45 amGreat. One comment: when you changed the state to absent to uninstall Apache, you should have probably change the name of the task (play) as well to read something like "Uninstall apache2 package"
mirzaindra
May 12, 2022 00:45 ami got this error when running the install_apache.yml:
ERROR! 'task' is not a valid attribute for a Play
The error appears to have been in '/home/mojo/ansible_test/install_apache.yml': line 3, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
– hosts: all
^ here
Walter Kelt
May 12, 2022 00:45 amOne of the finest technical presentation series I've seen. Well done ! thank you
Osiel Ramirez
May 12, 2022 00:45 amI like how easily you explain the yaml basics, just enough for what we need in this video. Thanks to you I'm getting the hang of git commands and ansible!
TC
May 12, 2022 00:45 amat 12:30 he says 'let's add another play', but he should have said 'let's add another task'.
Josh URKI
May 12, 2022 00:45 amGreat Job! Thank you so very much
Tarokh Yaghoubi
May 12, 2022 00:45 amYou are amazing Jay " keep going "
Ibrahim Kabbash
May 12, 2022 00:45 amMan, you are seriously amazing. Thank you!
Mathew Kargarzadeh
May 12, 2022 00:45 amDear Jay, your illustration of the first playbook was amazing. I loved it. Thank you again !!. Mat.
streamx2
May 12, 2022 00:45 amwhat is the become password
Robin A. Meade
May 12, 2022 00:45 am3:06 Did you add `become = True` to `ansible.cfg` like this:
[privilege_escalation]
become = True
Why not add `become_ask_pass = True` there too?
Thành Vũ
May 12, 2022 00:45 am8:40 ok equals two, what does number two mean ?
p/s :I understood, number two is the tasks
Volcker1929
May 12, 2022 00:45 amHow dare you sir! Emacs is clearly superior. Sure, I had to have my left hand amputated due to crippling arthritis, but is is a small price to pay for the privilege of using the superior text editor.
Irsal Yunus
May 12, 2022 00:45 amhi sir,
permission to ask there are tools such as ansible to manage mobile apps?? thanks
Albert Liu
May 12, 2022 00:45 amthis guy is amazing, even better than the videos that i pay on udemy
Khalid Sattar
May 12, 2022 00:45 amGreat introduction to Ansible. The depth and pace you adopt are just right. The section on ssh, git was very useful to have a great start in doing things the right way.
Amit Goel
May 12, 2022 00:45 amThanks for sharing such amazing contents, very helpful to learn ansible.
pgh pete
May 12, 2022 00:45 amThanks for the great series. Though I am not new to ansible, one can always learn something from others so I decided to watch them all.
I know it may sound trivial, but I think it is an important correction, or at least something that should be conveyed.
You refer to tasks within a play as plays. This may trip folks up if/when they ever test or go to certify on the topic.
For example:
—
# Simple playbook with two plays
– name: name of first play
hosts: all
tasks:
– name: name of first task
<snip>
– name: name of second task
<snip>
– name: name of second play
– name: name of first task
<snip>
– name: name of second task
<snip>
In all honesty, most of us simply execute all of our items within a single play but as individual tasks… however I think its fairly important to distinguish the differences between plays and tasks. Another way to look at it is that the first, non-tabbed column are individual plays, everything indented underneath them is part of that play.
I hope this just came through as a suggestion for completeness and not a nitpick. 🙂 Thanks again for taking the time to film, edit, and share your videos.
Liviu Navacioiu
May 12, 2022 00:45 amI may have misunderstood how Ansible works, but, still…, what's behind the ansible module? In playbooks we can use modules with their respective parameters, but what makes that module execute whatever it says it will execute on an agentless machine? What made the apt module do its job it there is nothing on the targeted machines to interpret that module and do whatever the module is intended to do, in this case to install a package using apt?
kjakobsen
May 12, 2022 00:45 amThe indentation requirements makes my blood boil.
roy a
May 12, 2022 00:45 amSir the writing format you are using in writing the playbook its a bit confusing as the alignments of sentences are having long spaces or hyphens is this standard change when writing long playbooks. I am new to this sort of thing i don't have any developer/coder background
Jean-Philippe Henry
May 12, 2022 00:45 am"I won't judge you even if it's emacs", lol, you killed me
Thank you so much for your work. Know that it helps a lot demystifying Ansible.
Ozmo Syd
May 12, 2022 00:45 amGoing through the series. And have to say … Love ya work chap.
Hossein Vahedi
May 12, 2022 00:45 amThis playlist is amazing!
seocamo
May 12, 2022 00:45 amwhy compare nano and vim with emacs … nano and vim is text editors and emacs is a OS … how can you compare this ?