⭐Full Ansible Tutorial for Beginners 2021: If you are a beginner or even if you have some kind of experience working in IT, this series will help you at every step in your goal towards pure automation with 🎉 Slides on the channel are available here in the link below: www.ko-fi.com/pythoholic
started with it, very clear explainations :). However difficullt to rewind in case you feel lost. You should have divided topic wise as most of the long youtube tutorials are.. so I can resume comfortably anytime.
Its really very well designed with good and easy examples. Course material is really awesome. Trainer's presentation is really good. Its easy to understand the ansible once you complete this training. Thanks a lot.
A little confusion: @40:20 you mentioned that Grinnding is a key value within which there are nested dictionary key:pair values and that will be represented just with an indentation (and not a hyphen) but at @43:25 despite of Milk being a dictionary (regardless if it's nested or not) why does it start with a hyphen ? Shouldn't it be more like this ? Ingredients: - Coffee - Flavour Liquid Milk: (without a hyphen) - Dominos - Low Fat - Toned
Just a tip if managed node is unable to connect with control node even after adding the right permissions sudo nano /etc/ssh/sshd_config add the new user ansible (if created) into the allowed users bit
Thank-you very much for this explanation of the presentation of Ansible YAML. I gave been struggling to write working Ansible code because each example I see seems presents the code in a different format. I hope now that I can use your examples to properly explain to the Ansible processor what I want to do. Thanks again.
Such a great tutorial - thank you so much! You are an excellent teacher. I do have a question though. I am accessing my ansible EC2 instance via Putty. I noticed that each time I log out of Putty and then later back in, I must re-execute the two commands 'ssh-agent bash', then 'ssh-add ~/.ssh/ec2-key.pem'. Is this because each shell that gets started needs to be told where the ssh key is before the ec2-to-ec2 connection can be made? Is there a preferred way to automate this as part of .bashrc or similar? Thank you again for this ansible tutorial.
Greate tutorial. Thanks for the content. Can you please provide the link for security configuration that is required to communicate from one ec2 instance to another using ansible playbook. I mean without configuring it the host instances will not allow master node to access it.
To install Ansible on your RHEL 9.4 VMs, you can follow these steps: 1. Enable the EPEL repository: sudo dnf install epel-release -y 2. Install Ansible: sudo dnf install ansible -y If you run into any issues, make sure the VMs have internet access and are updated: sudo dnf update -y Try this and let me know if you need more help!
interesting Iam bilingual in French 🇨🇦 my friends wonder if they could also have it in French. anyway to translate your tutorials in French? website or apps ?
Great tutorial! thank you so much :) You just need to get rid of the habit saying "isn't it" or add a counter at the top right 😅 (I'm kidding, hopefully this passes through as a constructive criticism and not an insult)
There is a membership on the channel but its for the support (for now there are no benefits attached) but you will get a shoutout on multiple social media platforms. if you wish u can support the channel by membership paypal buymeacoffee
Hi, please at the 1hr 34 mark, a little confused on how to set the permissions after running ansible-playbook install_nginx.yaml I got a permission error.. Please can you direct me on what to do. Learning Ansible for the first time
This could be due to several reasons, and without the specific error message, I can only provide some general advice on what might be going wrong. 1. **You might not have sufficient permissions on the local machine to execute the playbook.** Ansible playbooks should typically be executed as a user with sufficient permissions to write to the necessary directories and make the necessary system changes. If you're on a Unix-like system, you might need to use `sudo`: ``` sudo ansible-playbook install_nginx.yaml ``` 2. **The remote user specified in your Ansible playbook might not have sufficient permissions.** Ensure the remote user has sufficient permissions on the target machine(s). If the tasks in your playbook require elevated privileges, you may need to include `become: yes` in your playbook to allow Ansible to execute tasks with sudo privileges. 3. **The SSH keys might not have been properly set up on the remote machine(s).** If you're using SSH keys for authentication (which is recommended), make sure that the public key of the machine running the playbook is added to the `~/.ssh/authorized_keys` file of the remote user on the target machine(s). 4. **File permissions on the playbook file itself might be incorrect.** Make sure you have the necessary read permissions on the `install_nginx.yaml` file. You can check this with `ls -l install_nginx.yaml` and set with `chmod` if needed. For example, `chmod 644 install_nginx.yaml` will ensure the file is readable. If you're still facing issues after checking these possibilities, please provide the specific error message you're seeing, and I'll be able to provide more targeted help.
@@Pythoholic I am using it on Termius, following your instructions as I go. But you didn't explain how to set permission at that point. I have all three EC2 like you do in the tutorial..
OK then it's great not to worry, please set the permission for the key as chmod 400 keyname and please check the connectivity. Please do send the error messgae
When I declare the - name: Ansible copy file to remote server copy: src: '{{ base_path }}sample.txt' dest: '{{ base_path }}' HELP:- I am getting an ERROR! conflicting action statements: dest, src The error appears to be in '/home/ec2-user/install_nginx.yml': line 31, column 7, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: - name: Ansible copy file to remote server ^ here
I kinda wish you would have gone through everything, including creating the key. I got so lost and you spoke so fast. I was excited but that was not fun to try to figure out why nothing was working. I wish you gave more guidence.
Hi brother, I'm getting the error "Could not open a connection to your authentication agent". While execute the command ssh-add ~/.ssh/ec2-key.pem. could you please check and share your feedback.
fatal: [IPV4 address]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).", "unreachable": true}. Getting this error. Where exactly I went wrong in installing nginx service in Target1 instance from Master instance
I just got it to work though by using the --key-file argument ansible-playbook install-nginx.yaml --key-file "ec2-key.pem" because the ec2-key.pem is located in the same folder as my playbook
Hi, I am facing an issue. Could you please help for below error? ansible-playbook install_nginx.yaml -v No config file found; using defaults [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' ERROR! '-name' is not a valid attribute for a Play The error appears to be in '/home/ec2-user/install_nginx.yaml': line 1, column 3, but may be elsewhere in the file depending on the exact syntax problem. The offending line appears to be: - name: Setup nginx server on myserver list (host group) ^ here
It looks like there's a syntax error in your Ansible playbook. In Ansible, the correct syntax for defining a play is to use a hyphen followed by a space before the `name` attribute, like this: ```yaml - name: Setup nginx server on myserver list (host group) hosts: your_host_group tasks: - name: Install Nginx yum: name: nginx state: present ``` Make sure that you have a hyphen (`-`) followed by a space before the `name` attribute at the beginning of your play. Also, ensure that you specify the `hosts` field to define which hosts or groups the play should target. If you want to target all hosts, you can use `hosts: all`. Here's a corrected version of your playbook: ```yaml - name: Setup nginx server on myserver list (host group) hosts: your_host_group tasks: - name: Install Nginx yum: name: nginx state: present ``` Replace `your_host_group` with the appropriate group name or `all` if you want to target all hosts in your inventory. If you're using a different package manager (like `apt` for Debian-based systems), make sure to adjust the task accordingly.
This is regarding the ping command "ansible ansible-target-1 -m ping -i inventory.txt". I have followed the video and I was able to ping the other servers from Ansible master servers. But if I logout of the Ansible-master server and again log in and try the ping command the ping gets failed with the below message. "ansible-target-3 | UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).", "unreachable": true" Only after I add the .pem key to the .ssh folder again the ping gets successful.(This is even after having the ec2-key.pem file in the .ssh folder) ssh-agent bash cp ec2-key.pem ~/.ssh/ ssh-add ~/.ssh/ec2-key.pem I feel this is a Linux issue. Can someone explain me why this is happening?
⭐Full Ansible Tutorial for Beginners 2021: If you are a beginner or even if you have some kind of experience working in IT, this series will help you at every step in your goal towards pure automation with
🎉 Slides on the channel are available here in the link below: www.ko-fi.com/pythoholic
started with it, very clear explainations :). However difficullt to rewind in case you feel lost. You should have divided topic wise as most of the long youtube tutorials are.. so I can resume comfortably anytime.
There is a playlist you can refer ; please check that : th-cam.com/play/PLiH9_MU-6RjLIUCbpJv2xZc9zwLPkdyOY.html
@@Pythoholic Thank you so much for responding. Does it have the same content as that of this tutorial?
Its really very well designed with good and easy examples. Course material is really awesome. Trainer's presentation is really good. Its easy to understand the ansible once you complete this training. Thanks a lot.
thanks 😊 for the support
Such a clean and detailed explanation!!! Really Thankful to you !!
A little confusion: @40:20 you mentioned that Grinnding is a key value within which there are nested dictionary key:pair values and that will be represented just with an indentation (and not a hyphen) but at @43:25 despite of Milk being a dictionary (regardless if it's nested or not) why does it start with a hyphen ?
Shouldn't it be more like this ?
Ingredients:
- Coffee
- Flavour Liquid
Milk: (without a hyphen)
- Dominos
- Low Fat
- Toned
Thanks anurag
Will check it and update if missing
you can use ssh-keygen command instead of copy pasting the private key
Yes, thats right actually for beginners i wanted to keep it simple so that they can just understand the concept. But you are right
Just a tip if managed node is unable to connect with control node even after adding the right permissions
sudo nano /etc/ssh/sshd_config
add the new user ansible (if created) into the allowed users bit
Yes thanks a lot Mehren...makes sense.. actually some users find it difficult. So we need to keep it simple for everyone.
Thank you so much. I learnt a lot on ansible.
awsome course and very clear explanation with aws. so much helpful
This is very impressive and expressive removing a lot of stress and strain attached to this subject. Thanks for ajob well done.
Thank-you very much for this explanation of the presentation of Ansible YAML. I gave been struggling to write working Ansible code because each example I see seems presents the code in a different format. I hope now that I can use your examples to properly explain to the Ansible processor what I want to do.
Thanks again.
Hi - is there a link to pay for the slides with US bank/CC/ or Paypal? I am not able to pay for them currently on your site
i have enabled PayPal, please check it again. Thanks for the support buymeacoffee.com/pythoholic
Such a great tutorial - thank you so much! You are an excellent teacher.
I do have a question though. I am accessing my ansible EC2 instance via Putty. I noticed that each time I log out of Putty and then later back in, I must re-execute the two commands 'ssh-agent bash', then 'ssh-add ~/.ssh/ec2-key.pem'. Is this because each shell that gets started needs to be told where the ssh key is before the ec2-to-ec2 connection can be made? Is there a preferred way to automate this as part of .bashrc or similar?
Thank you again for this ansible tutorial.
yes, please read this linuxhint.com/how_to_use_sshpass_to_login_for_ansible/
www.devopsschool.com/blog/how-to-access-ansible-remote-machine-using-ssh-user-and-key/
This is a nice course for Ansible, "isn't it?"
Excited for Ansible! Sir, please cover Jenkins too.
Sure i will try and cover that as well .
Please cover jenkins also
Hi,
can you please share some steps for Domain join playbook for linux and window server.
OK Chetan I will check it and get back
Greate tutorial. Thanks for the content. Can you please provide the link for security configuration that is required to communicate from one ec2 instance to another using ansible playbook. I mean without configuring it the host instances will not allow master node to access it.
Sure i will do that thanks for the feedback
Thank you so much bro ! Nice explanation
thanks bro
Nice video I will watch later thank you 😊
Please cover on how Ansible can be used for network automation, this will be helpful for network engineers..
Thanks
sure i will do that
Amazing session💐💐
Thank you once again😊
Superbly explained the concept 🙏
Wow! I think this will be awesome video. As usual 😉
Hi, Which tool do you use to make these presentations ? Ms powerpoint or something else ?
Just powerpoint :)
@@Pythoholic oh great 👍. Thanks
Thanks for the effort
How can i use this to monitor an IP for reachability and as well log outage/downtime/unreachability to that ip
Really good explanation thanks.
Thanks for this amazing video
bro,, did u completed the full course?
Amazing tutorial bro, Appreciate ur efforts
Thank you :)
Will definitely watch it
Instead of AWS EC2 instances, I have installed 2 VMs with OS RHEL 9.4, but unable to install ansible in the servers.
To install Ansible on your RHEL 9.4 VMs, you can follow these steps:
1. Enable the EPEL repository:
sudo dnf install epel-release -y
2. Install Ansible:
sudo dnf install ansible -y
If you run into any issues, make sure the VMs have internet access and are updated:
sudo dnf update -y
Try this and let me know if you need more help!
Good tutorial, but the ads for your socials every 15 seconds are very distracting.
Thanks for the feedback I will remove them
Hi I have tried same with rehl in ec2 but it's not working in setup
interesting Iam bilingual in French 🇨🇦 my friends wonder if they could also have it in French. anyway to translate your tutorials in French? website or apps ?
i will try and put the french captions
Sir will u provide online class for devops
Sir all the training videos are on youtube only at the moment
as and when if there is a online class plan i will update you
Hi ,
instead of atom if i am using pycharm then what plugins do i have to install . Can you please suggest .
same u can install json plugin
ansible plugin
Great session 👏
Great tutorial! thank you so much :)
You just need to get rid of the habit saying "isn't it" or add a counter at the top right 😅
(I'm kidding, hopefully this passes through as a constructive criticism and not an insult)
hey thanks for the feedback. i will surely make it a point. 👍👍
How can I solve 'missing sudo password' when run ad-hoc commands with -b flag?
Please help!
you can pass it along with the cli command
Hi, non of the payment link is working for me from US. Please enable paypal to give support.
i am working on a different gateway
will update you guys once its done thanks for letting me know
Nice video
thanks
Annoying pop-ups for subscription during the video. Screw that.
Thanks john for the feedback
Will keep in mind in the upcoming videos
How to give a gift of token ?
How to join into your channel ?? And what benefits I receive by joining ?
There is a membership on the channel but its for the support (for now there are no benefits attached) but you will get a shoutout on multiple social media platforms. if you wish u can support the channel by membership paypal buymeacoffee
@@Pythoholic it is using PayPal gateway ? Let me try it .
Hi, please at the 1hr 34 mark, a little confused on how to set the permissions after running ansible-playbook install_nginx.yaml I got a permission error.. Please can you direct me on what to do. Learning Ansible for the first time
This could be due to several reasons, and without the specific error message, I can only provide some general advice on what might be going wrong.
1. **You might not have sufficient permissions on the local machine to execute the playbook.** Ansible playbooks should typically be executed as a user with sufficient permissions to write to the necessary directories and make the necessary system changes. If you're on a Unix-like system, you might need to use `sudo`:
```
sudo ansible-playbook install_nginx.yaml
```
2. **The remote user specified in your Ansible playbook might not have sufficient permissions.** Ensure the remote user has sufficient permissions on the target machine(s). If the tasks in your playbook require elevated privileges, you may need to include `become: yes` in your playbook to allow Ansible to execute tasks with sudo privileges.
3. **The SSH keys might not have been properly set up on the remote machine(s).** If you're using SSH keys for authentication (which is recommended), make sure that the public key of the machine running the playbook is added to the `~/.ssh/authorized_keys` file of the remote user on the target machine(s).
4. **File permissions on the playbook file itself might be incorrect.** Make sure you have the necessary read permissions on the `install_nginx.yaml` file. You can check this with `ls -l install_nginx.yaml` and set with `chmod` if needed. For example, `chmod 644 install_nginx.yaml` will ensure the file is readable.
If you're still facing issues after checking these possibilities, please provide the specific error message you're seeing, and I'll be able to provide more targeted help.
@@Pythoholic I am using it on Termius, following your instructions as I go. But you didn't explain how to set permission at that point. I have all three EC2 like you do in the tutorial..
@@Pythoholic Thank you so much
OK then it's great not to worry, please set the permission for the key as chmod 400 keyname and please check the connectivity. Please do send the error messgae
@@Pythoholic Thank you so much for your time. I will send the error as soon as I get back to my pc. Thank you for your time and patienceb
Super tutorial good if you made this series in putty also
thanks rajesh
When I declare the
- name: Ansible copy file to remote server
copy:
src: '{{ base_path }}sample.txt'
dest: '{{ base_path }}'
HELP:- I am getting an ERROR! conflicting action statements: dest, src
The error appears to be in '/home/ec2-user/install_nginx.yml': line 31, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Ansible copy file to remote server
^ here
I have updated the file now. Please check and let me know
@@Pythoholic Thank you so much. How do I access the file again. Will it let me re-download.
@Pythoholic, How do I re-access the file. Do I have to pay again or you have a repo.
No it's totally free..please check pythoholic git repo
Thank you so much.
Great demo.
I don't understand group variables totally
I kinda wish you would have gone through everything, including creating the key. I got so lost and you spoke so fast. I was excited but that was not fun to try to figure out why nothing was working. I wish you gave more guidence.
Thanks for the feedback., i will surely improve on that.
Hi brother, I'm getting the error "Could not open a connection to your authentication agent". While execute the command ssh-add ~/.ssh/ec2-key.pem. could you please check and share your feedback.
Sure vivek let me check and get back
i'm having the sam error
I am unable install ansible through termius as it is showing no command: amazon-linux-extras
I have installed it on AWS ec2 instance where AWS Amazon Linux extra is available
@@Pythoholic when i tried ' sudo amazon-linux-extras install ansible2 ' in termius, it shows 'sudo: amazon-linux-extras: command not found'
please run it on a ec2 instance
fatal: [IPV4 address]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).", "unreachable": true}.
Getting this error. Where exactly I went wrong in installing nginx service in Target1 instance from Master instance
Me too! I tried the steps over and over, same error
I just got it to work though by using the --key-file argument ansible-playbook install-nginx.yaml --key-file "ec2-key.pem" because the ec2-key.pem is located in the same folder as my playbook
Same issue how did you resolved it??
Hi, were you able to establish connection with the ansible target from the main server??
Please change your key.permission
Check the video on how to connect to ec2 instance
Chmod 400 keyname
Hi, I am facing an issue. Could you please help for below error?
ansible-playbook install_nginx.yaml -v
No config file found; using defaults
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit
localhost does not match 'all'
ERROR! '-name' is not a valid attribute for a Play
The error appears to be in '/home/ec2-user/install_nginx.yaml': line 1, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Setup nginx server on myserver list (host group)
^ here
It looks like there's a syntax error in your Ansible playbook. In Ansible, the correct syntax for defining a play is to use a hyphen followed by a space before the `name` attribute, like this:
```yaml
- name: Setup nginx server on myserver list (host group)
hosts: your_host_group
tasks:
- name: Install Nginx
yum:
name: nginx
state: present
```
Make sure that you have a hyphen (`-`) followed by a space before the `name` attribute at the beginning of your play. Also, ensure that you specify the `hosts` field to define which hosts or groups the play should target. If you want to target all hosts, you can use `hosts: all`.
Here's a corrected version of your playbook:
```yaml
- name: Setup nginx server on myserver list (host group)
hosts: your_host_group
tasks:
- name: Install Nginx
yum:
name: nginx
state: present
```
Replace `your_host_group` with the appropriate group name or `all` if you want to target all hosts in your inventory. If you're using a different package manager (like `apt` for Debian-based systems), make sure to adjust the task accordingly.
This is regarding the ping command "ansible ansible-target-1 -m ping -i inventory.txt".
I have followed the video and I was able to ping the other servers from Ansible master servers. But if I logout of the Ansible-master server and again log in and try the ping command the ping gets failed with the below message.
"ansible-target-3 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).",
"unreachable": true"
Only after I add the .pem key to the .ssh folder again the ping gets successful.(This is even after having the ec2-key.pem file in the .ssh folder)
ssh-agent bash
cp ec2-key.pem ~/.ssh/
ssh-add ~/.ssh/ec2-key.pem
I feel this is a Linux issue. Can someone explain me why this is happening?
Yes it doesnt save the state
so we need to push the key in ssh
its just for a demo so that we can see how it could be done on more than one machine.
Such a clean and detailed explanation!!! Really Thankful to you !!😊
which vm should i use in case, Iam using azure cloud provider?
You can use this : azure.microsoft.com/en-us/products/virtual-machines/