Getting started with Ansible 06 - Writing our first Playbook

Поделиться
HTML-код
  • Опубликовано: 20 сен 2024
  • 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): linux.video/an...
    Part 2 (SSH Overview & Setup): linux.video/an...
    Part 3 (Setting up the Git Repository): linux.video/an...
    Part 4 (Running Commands): linux.video/an...
    Part 5 (Running Elevated Commands): linux.video/an...
    Part 6 (This video)
    Part 7 (The "when" Conditional): linux.video/an...
    Part 8 (Improving your Playbook): linux.video/an...
    Part 9 (Targeting Specific Nodes): linux.video/an...
    Part 10 (Tags): linux.video/an...
    Part 11 (Managing Files): linux.video/an...
    Part 12 (Managing Services): linux.video/an...
    Part 13 (Adding Users & Bootstrapping): linux.video/an...
    Part 14 (Roles): linux.video/an...
    Part 15 (Host Variables): linux.video/an...
    Part 16 (Templates): linux.video/an...
    🙌 Support me on Patreon and get early access to new content!
    ➡️ learnlinux.lin...
    ☁️ Get $100 in credit toward deploying your very own Linux servers on Linode!
    ➡️ linode.com/lear...
    🛒 Affiliate store for Linux compatible hardware/accessories (commission earned):
    ➡️ learnlinux.lin...
    💻 Check out the Tiny Pilot KVM for your Homelab (commission earned):
    ➡️ learnlinux.lin...
    Wiki article for this video:
    www.learnlinux...
    🐦 Follow me on Twitter!
    ➡️ learnlinux.lin...
    💬 Official LearnLinux.tv Community:
    ➡️ community.lear...
    📖 Check out jay's latest book, Mastering Ubuntu Server 3rd Edition. Available now!
    ➡️ ubuntuserverbo...
    👨 More about me:
    ➡️ www.jaylacroix...
    ➡️ www.learnlinux...
    💽 How to create a bootable flash drive for installing Linux:
    ➡️ linux.video/fl...
    🐧 Which distro do I use?
    ➡️ learnlinux.lin...
    🔐 How to better secure OpenSSH:
    ➡️ linux.video/se...
    ☁️ How to create a cloud Linux server with Linode:
    ➡️ learnlinux.lin...
    #AnsiblePlaybook #Ansible #LearnAnsible

Комментарии • 104

  • @victormazzocato7783
    @victormazzocato7783 5 дней назад

    Excelent tutorials. I´m down in the south of Brazil. In Porto Alegre. As I have been trying to self train in network automation, and searching a lot around, I came across this series of videos. Finally the fog is beginning to clear, thanks to the clarity of your tutorials.

  • @yichengliu
    @yichengliu 3 года назад +103

    this guy is amazing, even better than the videos that i pay on udemy

    • @Weirlive
      @Weirlive 2 года назад +10

      right? they are really well done.. I love that he went over basics like SSH keys prior to doing any Ansible content.

    • @brian4828
      @brian4828 Год назад +4

      Couldn't agree more. He's an excellent teacher and doesn't gloss over the issues that other instructors just take for granted are already known.

    • @c1sc0m
      @c1sc0m 6 месяцев назад

      😝 I totally agree!

    • @whitestarliew
      @whitestarliew 5 месяцев назад

      are you buy mumshad's course ?

  • @ToGoMania19
    @ToGoMania19 5 месяцев назад +2

    Thanks! I’m enjoying this Ansible series with Git also!

  • @HungNguyen-si2xe
    @HungNguyen-si2xe 2 года назад +3

    For the amount of videos that I have been watching, none is better than Jay's. Bless you and your family.

  • @zhulianstoyanov9198
    @zhulianstoyanov9198 7 месяцев назад +4

    the pace of the explanation is awesome. just what I needed. thank you for sharing your knowledge with us.

  • @KenPryor
    @KenPryor 10 месяцев назад +5

    I've started and stopped with Ansible videos before because they just didn't explain everything I needed to know. I'm so happy I found this series because I am finally getting all the info I need to get it working. I appreciate how you explain everything and make it so easy to understand. Thank you!

    • @LearnLinuxTV
      @LearnLinuxTV  9 месяцев назад +4

      I m really glad you found value and thank u for the kind comment

  • @fabrice9848
    @fabrice9848 Год назад +10

    I wish there were more youtubers like you... This Ansible series is fantastic!

  • @bensonwaweru4074
    @bensonwaweru4074 3 месяца назад +4

    You are an amazing tutor. Am now a pro in ansible and git just by watching your tutorial

    • @Crowncity
      @Crowncity 3 месяца назад

      Bro you're not lying at all 💯

  • @kodikodi9948
    @kodikodi9948 2 года назад +7

    this is a really great series. i never thought i could get this kind of quality instruction on youtube.

  • @walterkelt4475
    @walterkelt4475 3 года назад +12

    One of the finest technical presentation series I've seen. Well done ! thank you

  • @CoreyTyhurst
    @CoreyTyhurst Год назад +3

    I finally found the time to sit down and set this up on my homelab. Not only does it feel great to have ansible/automation working, but this also has been a great way to truly understand how ssh keys and git work from the command line. Top notch content. Thank you so much for enabling all of us noobs to upskill and do cool stuff!!

  • @jean-philippehenry5805
    @jean-philippehenry5805 3 года назад +8

    "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.

  • @mathewmickle3116
    @mathewmickle3116 5 месяцев назад +1

    Thank you soo much for this series and all the other ones you do.

  • @hovasty
    @hovasty Год назад +3

    I have to say, your videos are perfect! At first I saw other shorter tutorials about ansible on youtube but I had many questions that werent answered there. Then followed your tutorial and I am not even half your course yet but I can say that your course is great. It is as if you know what is in my head becouse you always explain everything I have in mind watching your tutorial. Perfectly organized and it just all makes sense . Great job and thank you for your work!

  • @khalidssattar
    @khalidssattar 3 года назад +3

    Great 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.

  • @DanCalloway
    @DanCalloway 4 года назад

    Jay, great series on Ansible! Just to let you know, I created three identical Ubuntu 20.04 LTS Server VMs in Virtual Box (by creating one and cloning the other two), then changed the hostnames on the 2nd and 3rd VM and set all Servers to static IP addresses before following your video series on running ansible playbooks. I performed all of this by setting up the VMs on my FerenOS Main PC allocating 1GB VRAM to the Servers, then did everything else from my Acer Aspire laptop. I was totally successful in running everything that you did in your videos. Being a retired IT guy myself, I found it extremely rewarding to be able to run multiple command executions on multiple servers simultaneously on a Linux (versus Windows) network. Great job!

  • @kenrq63
    @kenrq63 4 года назад +5

    A good series, thank you. I look forward to the next episodes.

  • @mathewkargarzadeh3158
    @mathewkargarzadeh3158 3 года назад

    Dear Jay, your illustration of the first playbook was amazing. I loved it. Thank you again !!. Mat.

  • @MarkusEicher70
    @MarkusEicher70 Год назад +1

    Great stuff, Jay. Thank you. Playbooks are bringing a lot of fun and efficiency into this. That's what I'm here for. Very helpful playlist so far. 🤝

  • @HuyNguyen-u1v
    @HuyNguyen-u1v 4 месяца назад +1

    so great content on ansible, easy to understand and follow

  • @Pghpete5
    @Pghpete5 3 года назад +1

    Thanks 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
    - name: name of second task
    - name: name of second play
    - name: name of first task
    - name: name of second task
    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.

  • @osielramirez7274
    @osielramirez7274 3 года назад

    I 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!

  • @jumaklap
    @jumaklap 11 месяцев назад

    Amazing series Jay! It's highly recommended! Thanks a lot for share!

  • @osada96
    @osada96 Год назад

    Just another great video from Jay. Thanks a lot!

  • @bashardlaleh2110
    @bashardlaleh2110 2 года назад +2

    playing your videos in 1.25 speed is perfect

    • @nikikovacs1923
      @nikikovacs1923 5 месяцев назад +1

      I just tried that, and my blood pressure instantly went up a notch. Nah, 1.00 is fine.

    • @bashardlaleh2110
      @bashardlaleh2110 5 месяцев назад

      @@nikikovacs1923 depends on your English and Tech skills 😉

    • @nikikovacs1923
      @nikikovacs1923 5 месяцев назад

      @@bashardlaleh2110 I could probably watch the whole thing in 2.0 (I teach Linux system administration at our local university and I'm a tech writer for the Linux Professional Institute). But do I really want to do that? Nope. Chi va piano va sano. :o)

  • @uripessach
    @uripessach Год назад

    Thanks a lot for this great Ansible course ! much appreciated 🙂

  • @MrSomaaoo
    @MrSomaaoo 4 года назад +2

    you are so awesome _ great topic plus easy explanation ever seen

  • @remy333
    @remy333 4 года назад +1

    Thank you for this so much. I use Ansible (and the free AWX GUI) to launch and combine playbooks and combines plays at work. While I’m very comfortable on the operational side, I still need this little boost with understanding the core authoring of playbooks. Really, thank you.

  • @Gandolfof
    @Gandolfof 3 года назад +2

    This playlist is amazing!

  • @gponciano1757
    @gponciano1757 Год назад

    Thanks for this course dude, this is gold content

  • @julschamp5330
    @julschamp5330 Год назад

    what a nice tutorial.. starting from the foundation practices.

  • @chillnacho
    @chillnacho Год назад +1

    Someone should make a package called chocobo, just to troll Jay....jk Great video! I'm learning a lot.

  • @ozmosyd
    @ozmosyd 3 года назад

    Going through the series. And have to say ... Love ya work chap.

  • @GuillermoPradoObando
    @GuillermoPradoObando 4 года назад +1

    Great content, looking forward to the next video

  • @user-mv2ro9sl1x
    @user-mv2ro9sl1x Год назад

    Excellent idea to use apache as example here !

  • @ibrahimkabbash8929
    @ibrahimkabbash8929 3 года назад

    Man, you are seriously amazing. Thank you!

  • @akashpatel2338
    @akashpatel2338 10 месяцев назад

    Awesome! Thanks!

  • @davidtalturejman9185
    @davidtalturejman9185 Год назад

    Awsome! Thank you

  • @amitgoel6759
    @amitgoel6759 3 года назад

    Thanks for sharing such amazing contents, very helpful to learn ansible.

  • @KernelKudos
    @KernelKudos 3 года назад

    You are amazing Jay " keep going "

  • @mihai6564
    @mihai6564 2 года назад

    thanks a lot for the tutorial

  • @harunaadoga
    @harunaadoga Год назад

    Thank you!

  • @georgesmith9178
    @georgesmith9178 2 года назад

    Great. 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"

  • @davidtalturejman9185
    @davidtalturejman9185 Год назад

    Youre amazing! Thanks for the good content man

  • @johnramz
    @johnramz Год назад +1

    Hello Jay @Learn Linux TV . One question, how do I know the exact name of the package I want to install? is there a list I can look up online? I noticed you knew beforehand that it was named "apache2".

  • @KyzaSaucer
    @KyzaSaucer 2 года назад

    legit content - well done and well presented

  • @cereus7421
    @cereus7421 2 года назад

    Thanks!

  • @BlAdYAdv
    @BlAdYAdv Год назад

    Awesome course . Thank You !

  • @krishnarawat5664
    @krishnarawat5664 2 года назад

    You are so awesome. Thanks for the video

  • @paragb2008
    @paragb2008 2 года назад

    Awesome

  • @blahblahblahblah2933
    @blahblahblahblah2933 4 года назад +1

    ESC :q! yourself! vim user! :D Enjoyed the series.

  • @devproco8063
    @devproco8063 Год назад

    Just for clarification, @8:40, I am assuming that `ok=2` because there were "two steps" that were performed on the node (including gathering facts) which were successful?

  • @joshurki5088
    @joshurki5088 3 года назад

    Great Job! Thank you so very much

  • @keshavgupta8496
    @keshavgupta8496 Год назад

    the content is pretty good and demos are awesome, kinda giving good competition to the pluralsight lectures...by Wes Higbee.

  • @anthonychaple3031
    @anthonychaple3031 2 года назад

    Great series 👍🏻

  • @jonathanrider4417
    @jonathanrider4417 2 года назад

    Your videos are the best on youtube! Thanks for all your efforts - I am learning lots. How about somrthing about password management? I have been usin Lastpass for many years but have become frustrated with it as most passwords seem to be associated with usernames. Any suggestions?

  • @vnetpost
    @vnetpost 2 года назад

    Thanks Jay

  • @danielpamiesteruel203
    @danielpamiesteruel203 9 месяцев назад

    god video, do you do make video for playbook installing a dns service on each server

  • @karobarc
    @karobarc Год назад

    Awesome videos for free

  • @ademgokce3136
    @ademgokce3136 7 месяцев назад

    his knowledge and explanation is great but both beginning and end of the video is too long which is not related content. Hopefully, he will take care this concern for upcoming series...

  • @roya2045
    @roya2045 3 года назад

    Sir 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

  • @MrSandshadow
    @MrSandshadow Год назад

    how to use ansible in the non interactive way? / how to use become without being asked for password but rather feed it throught var / env-var / stdio ?

  • @streamx2
    @streamx2 3 года назад +1

    what is the become password

  • @milesmccoo
    @milesmccoo Год назад

    "even if it's emacs". Suspicious. :-)

  • @liviunavacioiu4533
    @liviunavacioiu4533 3 года назад

    I 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?

    • @magetaaaaaa
      @magetaaaaaa Год назад +1

      The modules are written in Python. So when you call a module, there is a Python script that makes the OS calls, most likely using the os library in Python. So nothing is being installed on the remote machine, it is actually establishing an SSH connection and then running Python commands to do the work.

  • @tanuj05
    @tanuj05 3 года назад

    at 12:30 he says 'let's add another play', but he should have said 'let's add another task'.

  • @thanhvu5633
    @thanhvu5633 3 года назад

    8:40 ok equals two, what does number two mean ?
    p/s :I understood, number two is the tasks

  • @irsalyunus2979
    @irsalyunus2979 3 года назад

    hi sir,
    permission to ask there are tools such as ansible to manage mobile apps?? thanks

  • @reza.sadriniaa
    @reza.sadriniaa 2 года назад

    What is the name of the bar at the bottom of tmux?

  • @Volcker1929
    @Volcker1929 3 года назад

    How 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.

  • @mirzaindra
    @mirzaindra 2 года назад

    i 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

    • @matthewmackey7550
      @matthewmackey7550 Год назад

      did you fix this error?

    • @andrewreeves9492
      @andrewreeves9492 11 месяцев назад

      that would be the - name, either not alligned correctly to above or no space between the - and name, ansible is super fussy about spacing

  • @langalafaoriho455
    @langalafaoriho455 2 года назад

    I need more assistance learning ansible

  • @IrateGamingZealot
    @IrateGamingZealot Месяц назад

    I made the mistake of having cowsay installed while following this tutorial

  • @MauroJr87
    @MauroJr87 11 месяцев назад

    "I won't judge you, even if its emacs" 😂

  • @zeocamo
    @zeocamo 4 года назад

    why compare nano and vim with emacs ... nano and vim is text editors and emacs is a OS ... how can you compare this ?

    • @JamesGaither11
      @JamesGaither11 4 года назад

      Emacs is a text editor as well.

    • @zeocamo
      @zeocamo 4 года назад

      @@JamesGaither11 well using shall commands like echo and sed is better to change text files then Emacs so ... well ... emacs is not design to be good for any thing, it is design to do everything and do a really bad job of it because of this

    • @JamesGaither11
      @JamesGaither11 4 года назад

      @@zeocamo emacs is an old style text editor. Some people still prefer it. I am not one of those. I was just highlighting to you that it is a text editor since you said it was an OS.

    • @zeocamo
      @zeocamo 4 года назад

      @@JamesGaither11 yea ok i can see that, notepad is a text editor too .. for someone ...

    • @JamesGaither11
      @JamesGaither11 4 года назад

      @@zeocamo yes it is?

  • @nikikovacs1923
    @nikikovacs1923 5 месяцев назад

    "I won't judge you even if it's Emacs" ==> HA HA HA HA HA HA HA !!!!

  • @RobinAMeade
    @RobinAMeade 3 года назад

    3:06 Did you add `become = True` to `ansible.cfg` like this:
    [privilege_escalation]
    become = True
    Why not add `become_ask_pass = True` there too?

  • @ventin75
    @ventin75 2 года назад

    What is this become password?

    • @davetweens7687
      @davetweens7687 2 месяца назад

      It is the password to use the sudo command on the remote server

    • @davetweens7687
      @davetweens7687 2 месяца назад

      His user is jay on all of them and he set all passwords to be the same

  • @wysefavor
    @wysefavor 3 месяца назад

    i will judge you if it is emacs ..lol

  • @kjakobsen
    @kjakobsen 3 года назад

    The indentation requirements makes my blood boil.

    • @magetaaaaaa
      @magetaaaaaa Год назад

      It does seem really janky. I played around with it at my last job and it seemed like I got constant errors about the config file and lining things up. I have no issue in Python or in other languages with indentation, but for some reason yaml just never felt all that intuitive to me. I'd probably get it if I spent more time with it, but this is the only time I've ever come across that markup language.