Getting started with Ansible 14 - Roles

Поділитися
Вставка
  • Опубліковано 31 сер 2020
  • 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 14, we get started on roles. Roles in Ansible is one of its most amazing features, that allows you to categorize your hosts based on their intended purpose.
    Full series:
    Part 1 (Introduction): linux.video/ansible1
    Part 2 (SSH Overview & Setup): linux.video/ansible2
    Part 3 (Setting up the Git Repository): linux.video/ansible3
    Part 4 (Running Commands): linux.video/ansible4
    Part 5 (Running Elevated Commands): linux.video/ansible5
    Part 6 (Writing our First Playbook): linux.video/ansible6
    Part 7 (The 'when' Conditional): linux.video/ansible7
    Part 8 (Improving your Playbook): linux.video/ansible8
    Part 9 (Targeting Specific Nodes): linux.video/ansible9
    Part 10 (Tags): linux.video/ansible10
    Part 11 (Managing Files): linux.video/ansible11
    Part 12 (Managing Services): linux.video/ansible12
    Part 13 (Adding Users): linux.video/ansible13
    Part 14 (Roles): This video
    Part 15 (Host Variables): linux.video/ansible15
    Part 16 (Templates): linux.video/ansible16
    🙌 Support me on Patreon and get early access to new content!
    ➡️ learnlinux.link/patron
    Wiki article for this video:
    www.learnlinux.tv/getting-sta...
    🛒 Affiliate store for Linux compatible hardware/accessories (commission earned):
    ➡️ learnlinux.link/amazon
    💻 Check out the Tiny Pilot KVM for your Homelab (commission earned):
    ➡️ learnlinux.link/tinypilot
    🐦 Follow me on Twitter!
    ➡️ learnlinux.link/twitter
    💬 Official LearnLinux.tv Community:
    ➡️ community.learnlinux.tv
    📖 Check out jay's latest book, Mastering Ubuntu Server 3rd Edition. Available now!
    ➡️ ubuntuserverbook.com
    👨 More about me:
    ➡️ www.jaylacroix.com
    ➡️ www.learnlinux.tv/about-me
    💽 How to create a bootable flash drive for installing Linux:
    ➡️ linux.video/flash-usb
    🐧 Which distro do I use?
    ➡️ learnlinux.link/mydistro
    🔐 How to better secure OpenSSH:
    ➡️ linux.video/secure-ssh
    ☁️ How to create a cloud Linux server with Linode:
    ➡️ learnlinux.link/create-linode
    #Ansilbe #AnsibleCourse #AnsibleLinux
  • Наука та технологія

КОМЕНТАРІ • 55

  • @nixeverything
    @nixeverything Рік тому +26

    Just a lil tip for making all the folders and files for the structure in his example. Be inside the roles folder and type:
    mkdir -p {base,db_servers,web_servers,workstations,file_servers}/tasks
    This will make each folder in curly brackets contains a tasks folder in each.

    • @MarkusEicher70
      @MarkusEicher70 Рік тому +2

      Thanks for the handy tip, Ryan. 🤛

    • @magnuslator4719
      @magnuslator4719 Рік тому +2

      Thanks for the tip.
      From the project root folder, the following command can be run to create the roles folder and sub-folders:
      mkdir -p roles/{base,db_servers,web_servers,workstations,file_servers}/tasks

    • @bfrd9k
      @bfrd9k Місяць тому

      for role in base db web workstation file ; do ansible-galaxy role init --offline "${role}" ; done

  • @MCSMIK
    @MCSMIK Рік тому

    This is probably the first new thing that I did in ansible after watching this video, which actually worked the first time. Really appreciate your effort in making this series!

  • @jacksoncremean1664
    @jacksoncremean1664 6 місяців тому

    I always love how you break things down
    give people the basic tools they need to get started to then play around and familiarize themselves with the tool
    top quality as always!

  • @jgranahan
    @jgranahan 3 роки тому

    Really great, Jay. This brings a lot together, letting me hone my TMUX and VIM skills as well!! Love it!

  • @bluekornchips
    @bluekornchips Рік тому

    Fantastic video. I gave a take home assignment for Ansible and your video series is a life saver.
    Easy to understand, well spoken, and explains concepts immediately when questions may arise.
    Thank you!

  • @ThePandaGuitar
    @ThePandaGuitar 3 роки тому

    Clearly explained and easy to follow. Thank you very much!

  • @MarkusEicher70
    @MarkusEicher70 Рік тому +2

    Cool stuff, Jay! Thanks for another great part in this series. That makes a much better structure and allows to define custom roles I need in my setup. Now I can't wait to see the further improvements of using host variables. This series was a blast so far! 💪

  • @ice_tee
    @ice_tee 2 роки тому

    I was wandering here and there trying to learn proper execution of ansible and my search ended here. Slow, practical explanation and each and every step explained. Thank you so much for this !!!

  • @fabrice9848
    @fabrice9848 Рік тому

    You're an excellent teacher, and a perfect example of how the FOSS philosophy makes the world a better place.

  • @jhred3315
    @jhred3315 Рік тому

    Definitely clear my confusion about role! Thank you so much!

  • @cruepprich
    @cruepprich 3 роки тому +1

    Excellent, as all the other videos in this series. Thanks!

  • @mathewkargarzadeh3158
    @mathewkargarzadeh3158 3 роки тому

    Thank you Jay !!!. gratitude to you.

  • @jaecheokkim99
    @jaecheokkim99 Рік тому

    Jay. thank you for every videos :) it's definitely best ansible tutorial video.

  • @vialomur__vialomur5682
    @vialomur__vialomur5682 Рік тому

    The best series! This is great!

  • @hideyukikanazawa2761
    @hideyukikanazawa2761 3 роки тому

    Very nice and concise explanation for a not so intuitive topic.

  • @name1355_0ne
    @name1355_0ne Рік тому

    Thank you very much for the explanation!

  • @tsushima33
    @tsushima33 3 роки тому

    Great, easy to follow

  • @stalinengoma7680
    @stalinengoma7680 2 роки тому

    Excellente vidéo. I’m speechless

  • @arunkumarkt8730
    @arunkumarkt8730 3 роки тому

    superb explanation. Thanks a lot sir.

  • @shivakarki6887
    @shivakarki6887 2 роки тому

    You have been very helpful, thank you sir.
    I wish to learn Jenkins from you too, someday.

  • @johannesmauser5465
    @johannesmauser5465 Місяць тому

    very good video :)
    Worked first time

  • @miladvaziri3
    @miladvaziri3 2 роки тому

    so useful, thanks for teaching me

  • @debadutta75
    @debadutta75 Рік тому

    You are excellent Jay

  • @ayencoscolfield3312
    @ayencoscolfield3312 Рік тому

    Thank so much cant really thank you enough, you rock man

  • @samsonwong2397
    @samsonwong2397 2 роки тому

    excellent explanation

  • @hamidja1537
    @hamidja1537 Рік тому

    Thanks for sharing

  • @AkebonoRadio
    @AkebonoRadio 3 роки тому

    Thanks Jay!!!

  • @mihai6564
    @mihai6564 2 роки тому

    thanks for the video

  • @majorgear1021
    @majorgear1021 2 роки тому +1

    Well done! Btw, I notice you have a System76 linux laptop. Have you done any videos about it? From purchase to setting it up, to features of both the laptop and popos? I’m currently a Mac user, As more and more apps go subscription, I’m thinking about switching to Linux as my daily driver instead of just a server OS.

  • @bendono
    @bendono 16 днів тому +1

    Why not simply use "ansible-galaxy init " to setup the folder structure for roles?

  • @randzioful
    @randzioful 3 роки тому +17

    /> mkdir -p roles/{first_role,second_role,third_role}/tasks

  • @muksyed
    @muksyed 2 роки тому +1

    Hi Jay. Great videos.
    BTW, IMHO the “tree” command helps to see the entire role structure.

    • @mysydney71
      @mysydney71 6 місяців тому

      best Ansible roles explanation/example I have ever seen

  • @NH-ly7zc
    @NH-ly7zc 2 роки тому

    Thank you

  • @nixoncoronado5558
    @nixoncoronado5558 Рік тому

    Hello Jay, I want to create different roles to get status, start and stop supervisorctl. I would like to ask if possible to create one yml file to execute all those roles?

  • @JackReacher1
    @JackReacher1 3 роки тому

    Liked it

  • @SoulJah876
    @SoulJah876 2 роки тому

    This all worked with me leaving my html file inside the original files folder.

  • @gurlalsidhu2503
    @gurlalsidhu2503 2 роки тому

    not just ansible, i got to learn linux too :)

  • @petermuia9519
    @petermuia9519 Рік тому

    Hi Jay, I have religiously been following all the steps in all your labs for this Ansible series & have one query. After all the additions: copying & pasting into the relevant main.yml. Does one then remove the plays in the site.yml file that correspond to these copy & pastes. I took the liberty of removing these plays in my site.yml file & when I ran the new site.yml file, I got results not similar to your's. Example apache2 was installed on the other Ubuntu servers.
    To reiterate, until this Roles lab, all my previous labs corresponding to yours generate all results like your's

  • @Peet0103
    @Peet0103 Рік тому

    I understand now

  • @MrDominique1992
    @MrDominique1992 Рік тому +1

    So nobody knows the command ansible-galaxy? It creates all the role folder/subfolders/files in one command

  • @karobarc
    @karobarc 10 місяців тому

    i dont see the code for adding roles here

  • @pralaybagde4804
    @pralaybagde4804 3 роки тому

    Can u plz tell me , how to execute .sh file in ansible roles .

    • @rohitreddy578
      @rohitreddy578 3 роки тому +1

      - name: script execution
      command: sh /home/script.sh

    • @miyalys
      @miyalys 2 роки тому +1

      explicitly calling sh should not be necessary if the hashbang line is set?

  • @JamesGreen-gv4yn
    @JamesGreen-gv4yn Рік тому +2

    I find it interesting that you start by making a copy so that you have the original when that is precisely why you are using 'git'. You can go back to the original or see your change at any time by using the git commands.

  • @tjbredow
    @tjbredow 2 роки тому +1

    You must be very patient to do this all in nano.

  • @dylanevans2732
    @dylanevans2732 2 роки тому

    Thanks. You spelled vim wrong.

  • @fabrice9848
    @fabrice9848 Рік тому

    Seeing you using nano when you'd rather use vim is truly painful!

  • @alexanderpoplawski577
    @alexanderpoplawski577 3 роки тому +2

    Great series! I can't see the role where the user simone is created, like in the site_before_roles.yml. Did I miss that? EDIT: Found it, it is in the bootstrap.yml.

  • @hamidja1537
    @hamidja1537 Рік тому

    Thanks for sharing