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!
@yasinfarzanali2 ай бұрын
thank goodness for clear english. what a breath of fresh air.
@SaurabhSingh-hn9fc4 жыл бұрын
Hi, You don't have any idea, you're changing world for some people. I almost gave up learning Ansible, but after watching your videos cleared all my concepts, very crisp and clear explanation. Please don't ever stop making such videos.
@toptechskills4 жыл бұрын
Hi Saurabh, thank you so much for such a positive comment. I'm so happy that my videos have helped clear up the concepts so that you can keep going with Ansible. Good luck with everything 🙏
@SaurabhSingh-hn9fc4 жыл бұрын
@@toptechskills Thank you so much Man.
@saikrishnakatuboni50522 жыл бұрын
your tutorials makes the critical concepts simple to understand, Please continue the tutorials...
@jhred33152 жыл бұрын
Your tutorials are what I am going to look for! Thank you a ton!
@1BAmir4 жыл бұрын
Thank you so much 1000 times for all you helpful videos that you share with us! I hope to see more coming videos in your channel. If you decided to quit i just want to thank you!
@toptechskills4 жыл бұрын
Thank you for your very kind comment. I haven't quit, but I just haven't had time to make more videos because of my job. I will definitely come back and make more videos in future. Comments like this are very encouraging.
@1BAmir4 жыл бұрын
@@toptechskills Keep developing your self bro it's the most 1st thing! :) I also just want to mark your great work , the sound of your videos is the best one that i've heared. btw im 22 y.o from israel and I learned some IT , which made me to learn devops utilities in generaly and specificly in your channel! I've much more great things to say about your channel, just keep the good working my man , and I must to tell you the hard work that you invested in every each one of your videos paying off ! ! ! :) btw im so glad that my comment did courage you !
@toptechskills4 жыл бұрын
Thanks again! 🙏 Wish you the all the best on your IT journey, good luck in the future.
@MrSalFav Жыл бұрын
Really helpful , well explained , very precise on the topic well done. Thank you.
@noblenetdk4 жыл бұрын
Brilliant. Precise and to the point. Awesome. Would love to see some tasks done on a Windows box. And a base video for setup. Keep up the good work!
@toptechskills4 жыл бұрын
Hi Kim, thank you for the positive feedback, definitely want to do more with Windows in the future.
@kolektivmozak2384 жыл бұрын
Yep, clear, concise and right to the point! Good job
@toptechskills4 жыл бұрын
Thank you very much 🙏
@karthickbaskar68865 жыл бұрын
Superb sir, clear cut explanation. Easily understandable. Expecting more videos. You have an excellent teaching skill.
@tristenbryce59633 жыл бұрын
Not sure if you guys cares but if you guys are stoned like me atm then you can watch all the new movies on Instaflixxer. I've been streaming with my gf lately :)
@zachariahbraydon793 жыл бұрын
@Tristen Bryce Definitely, I have been using Instaflixxer for years myself :)
@sushmasingh90784 жыл бұрын
Awesome explanation.
@toptechskills4 жыл бұрын
Thank you Sushma 🙏
@dhir_AND4 жыл бұрын
@Percy Grunwald Could you please suggest the yaml editor for CentOS which helps in suggesting options and ensuring alignments while writing playbook like how we can see in your video.
@toptechskills4 жыл бұрын
Hi Dhirendra Rai, if you're using the command line, I'd suggest using vim with a yaml plugin. If you have a graphical desktop, you can use VS Code with the Ansible extension by Microsoft, which is what I am using in the video. Hope that helps, thank you for the comment.
@dhir_AND4 жыл бұрын
@@toptechskills Thank you!
@99988721083 жыл бұрын
Very good explanation with practical.
@toptechskills3 жыл бұрын
Thank you for your kind comment Anshul 🙏
@99988721083 жыл бұрын
@@toptechskills Sir, do you have any session on Ansible Tower or AWX?
@ashishsisodiya72634 жыл бұрын
Hi Percy, Thanks for taking time and create this video. I have logged in to all 3 of my nodes (CN and MN) as devops user. echo $HOME is returning /home/devops however when I am trying the same with playbook, directory is creating at /root with root:root ownership instead of in /home/devops with devops:devops. Can you please explain WHY ?
@toptechskills4 жыл бұрын
Hi, thank you for your comment. The reason this is happening is probably because you have `become: true` set on the play or the task. `become: true` will change your user to be `root` (by default), which means that $HOME would refer to the home directory of the root user (i.e. /root). To overcome this, you can set the directory explicitly (e.g. /home/{{ ansible_user }}, instead of using $HOME), or use `become_user: devops` on tasks that don't need to be run as root. Hope that helps.
@jack44553 жыл бұрын
Loved it. Thank you for clearing out things. I just subscribed your channel and I hope you cover these trivial but significant topics as well as other DevOps tools. Fantastic experience !
@toptechskills3 жыл бұрын
Thank you very much Jack, this means a lot to me 🙏
@sambha10435 жыл бұрын
In multiple directory creation scripts , template variable name item was not called in loop module ? ex: loop_item , on which variable loop is going to run ?
@toptechskills5 жыл бұрын
Hi Santu Kumar, in Ansible loops, the default name for loop variable in each cycle is "item". For example, if you have: loop: - a - b - c For the first cycle `item == "a"`, the second cycle `item == "b"`, cycle `item == "c"`. You can change the name of the loop variable with the `loop_control` + `loop_var` options: loop: - a - b - c loop_control loop_var: letter In this case, each cycle with have a "letter" variable. You can find more information about Ansible loops here: docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html.
@jcnarasimhan42184 жыл бұрын
Thumbs up on the lucid explanation ! How would you use file module in a playbook to just print the files in a directory?
@toptechskills3 жыл бұрын
Hi JC, to do something like that you'd be best off using the `find` module: docs.ansible.com/ansible/latest/modules/find_module.html#find-module. This has similar behavior to the `find` command in Linux. Hope that helps, thank you for your comment.
@jcnarasimhan42183 жыл бұрын
@@toptechskills Thanks a bunch, mate for getting back. ansible -i /usr/bin/inventorybin -m find -a "paths='/export/backup/rman/ORCL' file_type=file patterns='*20201025*.albp'" is the one I used, for future users who stumble on this thread.
@youtubebaba71304 жыл бұрын
Excellent presentation I love it Could you please make a video for user module and how to SSH
@toptechskills4 жыл бұрын
Hi, thank you for your comment. Great suggestions, I will definitely try to make a user module video in future, it's a really crucial module for managing a system. Regarding SSH, do you have any specific questions you're trying to answer?
@Dame4Lyf35 жыл бұрын
Great introduction to Ansible. Would it be possible to make a video in connecting Linux to windows, I've been trying to get this to work for the past week with no luck, the content is appreciated
@toptechskills5 жыл бұрын
Hi Dame F, thanks for your comment. I've had this feedback from a lot of people and I do plan on creating some content about this in the future. I'm currently busy making an Ansible course focusing on configuring Linux remote hosts, but after that I'd like to make a course on configuring Windows remotes. It will take me a little bit of time to get up to speed with the Windows remotes as I've never actually done it before at this point. There was an interesting comment on one of my Reddit posts with some information that might help you get started: - www.reddit.com/r/ansible/comments/axvmg6/a_penny_for_your_002_working_on_a_udemy_course/ehwjgrh/ - www.reddit.com/r/ansible/comments/axvmg6/a_penny_for_your_002_working_on_a_udemy_course/ehxo5i2/ Hope this helps!
@Dame4Lyf35 жыл бұрын
@@toptechskills Wow, thanks for the links, I look forward to your Udemy courses. Much thanks for the direction.
@muthavarapunaresh31555 жыл бұрын
Thank you for providing good information
@pratikshapi4 жыл бұрын
Hey, The playlist is just awesome. Do you know to run 2 or more roles async to each other? Thanks for the help
@toptechskills3 жыл бұрын
Hi Pratiksha Pai, I don't think this is possible looking at this issue: github.com/ansible/ansible/issues/19083. I've never seen this done before either, so I can't offer any advice from my experience on this, sorry.
@pratikshapi3 жыл бұрын
@@toptechskills thanks
@aditya3692 Жыл бұрын
Hi, Can you do a video on running a shell script from the playbook using shell module, The shell script should have some if elif loop in it and the output of the shell script should be saved as a variable in playbook and should be used in subsequent steps in Playbook
@merxvell5 жыл бұрын
So question in regards to the file structure and if i'm doing it correctly. Right now I have my playbook calling a role named basic which has a main.yml. Lets say I wanted to have mutliple small playbooks named copy, packages and the like. What would I have to put in my main.yml in order to call those files?
@toptechskills5 жыл бұрын
Hi merxvell, this is a really good question. I actually have an article that addresses this problem specifically: www.toptechskills.com/ansible-tutorials-courses/ansible-include-import-tasks-tutorial-examples/. Hope the article is helpful, let me know if you still have any unanswered questions and I'll do my best to fill in the gaps.
@dkallery0003 жыл бұрын
could you create videos about Ansible roles? Which tool are you using to execute the plays? (with actions)
@toptechskills3 жыл бұрын
Thank you for the suggestion. I am using VS Code as the code editor with the built in terminal and iTerm as the terminal.
@nageshwararao14132 жыл бұрын
Hi @percy grunwald thanks for the video i have a question don't want to change any permission or ownership of the file I just want to get the properties of file like ls -lrt details by using ansible playbook
@toptechskills Жыл бұрын
I'd say the `stat` module is best for this use case: docs.ansible.com/ansible/latest/modules/stat_module.html#stat-module
@rafisk1594 жыл бұрын
hii sir I didn't understand what happened when u changed grp and owner permissions as default path and ansible-user could u plzz explain that part
@toptechskills4 жыл бұрын
Hi Rafi, the `owner` and `group` arguments on the `file` module do the same as using `chown` in the shell, it changes the `owner` and `group` for the file to the specified Linux user or group. Hope this answers your question, thanks for your comment.
@sandeeputb5 жыл бұрын
Thanks for your video. Can u tell me the ide name u are using for yml.
@mottoyin4 жыл бұрын
Visual Studio Code presented by Microsoft
@gilberto.savoini5 жыл бұрын
Great. I have an ansible question: how to dynamically create a vm and transfer the ssh key, accessing the vm right afterwards. Following the channel of Brazil.
@toptechskills5 жыл бұрын
You can do these things using tools like Vagrant, which exposes a shell API for creating and managing VMs using a number of different providers (Oracle's VirtualBox being the default). Typically you'd use the Vagrant command line to spin up the VMs defined in a Vagrantfile, but there's nothing stopping you from doing this using Ansible's `command` or `shell` modules. Vagrant also allows for automatically provisioning the VM with Ansible, which means you won't need to worry about transferring an SSH key or anything (but you're still free to). More information about this is available here: - docs.ansible.com/ansible/latest/scenario_guides/guide_vagrant.html - www.vagrantup.com/docs/provisioning/ansible.html Do you have a particular use case in mind? What are you trying to achieve?
@gilberto.savoini5 жыл бұрын
@@toptechskills Thanks for your answer. I am using CloudStack. Right after provisioning the VM I need to transfer the ssh key and configure the machine. However, when trying to connect to the new VM, I get the message that the host is untrusted.
@toptechskills5 жыл бұрын
Hi Gilberto, this sounds like it's due to SSH host key checking. that is enabled by default in SSH and also Ansible. Host key checking works by comparing signatures of servers you connect to with the saved signatures in ~/.known_hosts. Usually SSH will interactively ask you to accept a new host's signature and add it to your ~/.known_hosts, but since Ansible isn't interactive by default it will simply not connect to a host that isn't in your ~/.known_hosts. I see that you have 2 main options here: 1) Connect to the host manually with SSH before running Ansible so SSH will add it to your ~/.known_hosts 2) Disable host key checking in Ansible, so it will accept a server as trusted even if it's not in your ~/.known_hosts Generally it's safer to keep host key checking enabled since it can prevent "man in the middle" attacks. Given your use case, it might be safe to do this, but take a look at the articles below before making your decision. www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r2.foto100/hostch.htm docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html#host-key-checking security.stackexchange.com/questions/39990/is-it-safe-to-disable-ssh-host-key-checking-if-key-based-authentication-is-used Hope this helps, good luck.
@gilberto.savoini5 жыл бұрын
@@toptechskills Hi Percy, Thanks so much for the help. The problem was solved. Time needed to wait between VM provisioning and ssh connection. I solved the issue with the wait_for module. After that, I can exchange ssh keys at runtime with ssh-keyscan and ssh-copy-id. Thank you very much, Hugs
@rizwankhana3124 жыл бұрын
Percy thanks for the playbooks and detailed explanation s. I need to playbook to add multiple users and set a default password and also prompt the users to update the new password during their first login using ansible
@toptechskills4 жыл бұрын
Hi Rizwan Khan A, sounds like something you can achieve with the `user` module (docs.ansible.com/ansible/latest/modules/user_module.html#user-module) to add the users with a strong, random password and then use the `command` module (docs.ansible.com/ansible/latest/modules/command_module.html#command-module) to call `passwd --expire ravi` (www.tecmint.com/force-user-to-change-password-next-login-in-linux/) Hope this helps, thanks for your comment!
@jankowalsky94733 жыл бұрын
Amazing tutorial :) Could we use the loop in the loop ... like in the Java for example " for (x =0 ... x++ ) { for ( y = 0 ... y ++) } , two times iterate ?
@toptechskills3 жыл бұрын
Thank you for the kind words. You can loop over nested lists using the `product` filter: docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-nested-with-cartesian. This is the tersest way to do this, but you can also do a loop with `include_tasks`: www.toptechskills.com/ansible-tutorials-courses/ansible-include-import-tasks-tutorial-examples/#how-include-tasks-for-each-item-in-a-loop. Hope that helps, thanks for your comment.
@nforlife2 жыл бұрын
Great video
@toptechskills2 жыл бұрын
Thank you!
@nforlife2 жыл бұрын
Could you make videos on dynamic inventory!😊😊
@garimabilkhu39054 жыл бұрын
Hi thank you for this video. it is really helpful I want to ask How I can add modules to ansible galaxy?
@toptechskills4 жыл бұрын
Hi Garima Nayyar, I guess you mean "role" and not "module"? As far as I know, Ansible Galaxy is only for roles. If you want to list your role on Ansible Galaxy, you can follow these instructions: galaxy.ansible.com/docs/contributing/creating_role.html. Thanks for your comment, hope that's helpful.
@rashminair905 жыл бұрын
Thanks for the video, I have 1 question - in this video I can see that you have created a symlink for a file, but if I have to create it for a folder, how does that work? Since I have few of my templates in multiple folders and I want my ansible template folder to point to those remote folders.
@toptechskills5 жыл бұрын
Hi Rashmi, creating symlinks for directories and files are the same. $ ln -s /path/to/file file_link # create a symlink at ./file_link -> /path/to/file $ ln -s /path/to dir_link # create a symlink at ./dir_link -> /path/to If you run `ls ./dir_link` it will work like `ls /path/to`
@rashminair905 жыл бұрын
@@toptechskills Thanks Percy, I appreciate your response, so we have to use shell command to create symlink to directory and cannot use ansible file module with state=link as it is applicable only to files. I had 1 more query, I am writing a playbook to execute the templates on remote server. So for that, I install my ansible rpm on remote server, then create a symlink to templates as templates are not in my ansible repo but installed as rpm on target servers. For example --> if /opt/ansible is my ansible dir then /opt/ansible/templates will point to /opt/app/config which will have templates in the subfolders . I have written below task for that ### - name: Ensure files are populated from templates template: src: "{{ item.src }}" dest: "{{ templates_destination }}/{{ item.path | regex_replace('.template$','') }}" force: yes with_filetree: "{{ templates_source }}" when: item.state == 'file' delegate_to: server1 But this task execution shows no logs , verbose output looks something like this -### TASK [Ensure files are populated from templates] ****************************************** task path: /delegate.yml:37 META: ran handlers META: ran handlers Any idea what the issue could be?
@toptechskills5 жыл бұрын
It seems like the issue could be that `server1` that you're delegating to doesn't have a file tree at `templates_source`. What happens if you don't delegate to another host and you run Ansible on a host that definitely has a file tree at `templates_source`?
@vitusyu95833 жыл бұрын
Excuse me to ask: what multi-tab ssh utility you are using in the demo ?
@toptechskills3 жыл бұрын
Hi Vitus, the application I'm using is iterm2 for Mac OS: iterm2.com/
@Raj-si5yz5 жыл бұрын
Can you make from basic ansible video
@toptechskills5 жыл бұрын
Hi Ankit, thanks for your comment. I'm currently working on a full course for Ansible to introduce people to Ansible from the most basic, up to advanced techniques. I hope to release it very soon (I am working on it every day). I'll make an announcement when the course is done, hope it will help you.
@Raj-si5yz5 жыл бұрын
@@toptechskills thnx Percy
@gaatutube4 жыл бұрын
I was about to ask this question as well.
@hprangana3 жыл бұрын
superb content
@toptechskills3 жыл бұрын
Thanks for your kind comments Isuru 🙏
@luislo01 Жыл бұрын
UR a genious!!!
@gg.wellplayed3 жыл бұрын
More Ansible Videos Pls
@kazeko03 ай бұрын
Thank you for this guide, I kept getting "ERROR! 'ansible.builtin.file' is not a valid attribute for a Play" and The offending line appears to be: --- - name: Create a directory if it does not exist ^ here I see now that I was completely omitting the tasks: section. Thank you so much!
@jonathan53765 жыл бұрын
Hi again ! This way to use loop seems not working on every ansible version, I have ansible 2.4 and it doesn't work : - name: create multiple directories in a loop file: path: "$HOME/{{ item }}" state: directory loop: - test_directory1 - test_directory2 - test_directory3 Instead I use with_list like this : - name: create multiple directories in a loop file: path: "$HOME/{{ item }}" state: directory with_list: - test_directory1 - test_directory2 - test_directory3
@toptechskills5 жыл бұрын
Hi Jonathan, you're right, the `loop` keyword was introduced in Ansible version 2.5. If you're using
@bhupendrasinghsuri4962 ай бұрын
Request to share ansible-playbooks on synchronize, group_by, add_host, yum_repository & assemble modules.
@aleksanderostrowski7785 Жыл бұрын
COOL 😊
@kirtim19302 жыл бұрын
I like your videos. Can you show how to read XML file
@toptechskills2 жыл бұрын
Thank you, I will keep that in mind. In the mean time, I found this, which might be helpful for you: github.com/ansible-collections/ansible.utils/blob/main/docs/ansible.utils.from_xml_filter.rst
@bhupendrasinghsuri4962 жыл бұрын
Liked this video of yours but I would appreciate if you would take effort on making a new video on synchronize module.
@ShivamSharma-xz5je3 жыл бұрын
ansible_user variable is not working for my Ansible 2.6.9 Somebody please tell an alternative.
@toptechskills3 жыл бұрын
How are you passing this variable?
@tamilselvan83435 жыл бұрын
sir can u please reply me what is {{ ansible_user}}.i dont know
@toptechskills5 жыл бұрын
Hi Tamil Selvan, the `ansible_user` variable is one of the "connection variables" that is available for each host you are managing and represents the user that you have connected to the server with (the SSH user if you're managing Linux hosts). The `{{ ansible_user }}` is templating out the SSH user used to connect to the server in the example. More information about connection variables: docs.ansible.com/ansible/latest/reference_appendices/special_variables.html#connection-variables Hope this helps, thanks for your comment.
@tamilselvan83435 жыл бұрын
@@toptechskills thanks for ur reply sir and please update the devops tools and videos.pls take my suggestion
@sailu2032254 жыл бұрын
IT WAS WERY HELPFUI
@toptechskills4 жыл бұрын
Thank you Sai, glad it was helpful for you 🙏
@yogeshsingh30284 жыл бұрын
Saviour i had to read docs otherwise buddy :)
@toptechskills4 жыл бұрын
Thanks Yogesh, glad I could help
@jonathan53765 жыл бұрын
Hi ! Your task "Ensure file exists" modify the date of the file so I use this code : - name: Test if file file.txt exists stat: path: /tmp/file.txt register: varFile - name: remove file file: path: /tmp/file.txt state: absent when: varFile.stat.exists == true - name: Information file.txt fail: msg: "There is no file file.txt." when: varFile.stat.exists == false
@toptechskills5 жыл бұрын
Hi Jonathan, thanks for the comment. You're right, using the "state: touch" in this way would modify the access time and modification time of the file each time it runs. Your code looks totally correct, but it seems to be doing something different to "ensure file exists". It looks like your code will remove the file if it already exists (state: absent when stat.exists) and fail when the file does not exist (fail when not stat.exists). There is an easier way to ensure a file exists, but without modifying the access_time and modification time by doing this: - name: ensure file exists (without changing atime/mtime) file: path: /path/to/file state: touch access_time: preserve modification_time: preserve Hope that helps!
@jonathan53765 жыл бұрын
@@toptechskills, Yes it helps a lot, thank you ! Where did you find this parameters ? (And you're right if the file exists in my code, I remove it)
@toptechskills5 жыл бұрын
I found the parameters in the documentation for the `file` module on Ansible docs. Here's the link: docs.ansible.com/ansible/latest/modules/file_module.html#file-module
@sudhakarm95193 жыл бұрын
How to delete multiple files at a time?
@toptechskills3 жыл бұрын
You can pass multiple files to `rm`: rm file1 file2 or use wildcards: rm file* The command above will remove all files in the current directory that start with "file". Hope that helps, thanks for your comment.
@JackReacher13 жыл бұрын
Hi I really like the content but the way it is delivered can still be improved a lot. Please stop using the music in the background, it is distracting and increase views to 200%