My Ansible Setup for Tutorials

  Рет қаралды 7,801

Percy Grunwald from TopTechSkills

Percy Grunwald from TopTechSkills

Күн бұрын

Пікірлер: 36
@linuxdoesmatter5542
@linuxdoesmatter5542 Жыл бұрын
Thank you for sharing your knowledge. Your explanations are great.
@jiancarlotv
@jiancarlotv 4 жыл бұрын
Hi Percy.. I'm amaze with your videos. Can you show your configuration with your VSCode or make a tutorial how you do it? And how would you able to run the playbook from it. BTW Im using windows :) thanks
@toptechskills
@toptechskills 4 жыл бұрын
Hi Jian Carlo, thanks for your comment. My full VS Code configuration is available here: gist.github.com/percygrunwald/37e5b06dad39c47a42df3af93e4d11ab (you can use the marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync extension to load it). Unfortunately my configuration is for Mac, so the keybindings might not work. I will definitely try to make a video about IDE/editor configuration in future, it's really important to be able to use your editor effectively to make your programming experience enjoying and productive. The feature I'm using to run the playbook is the integrated terminal feature that is available by default in VS Code: code.visualstudio.com/docs/editor/integrated-terminal. I have it bound to Cmd + Shift + M, so I can bring it up quickly to run commands. Hope that helps!
@studio07photo
@studio07photo Жыл бұрын
Hello Percy, you have such amaizing content and I love your channel, I have a question, is it possible to setup code to run the ansible playbooks which are saved in my ansible server? or it has to be local as you have it here? Thank you!
@toptechskills
@toptechskills 11 ай бұрын
Thank you for your comment and sorry for my slow reply. You can definitely run ansible playbooks that are saved on a remote server. Simply install ansible on the remote server and run the playbook directly from your shell on the server, everything _should_ work pretty much identically to running it on your local machine.
@cooljassu
@cooljassu 5 жыл бұрын
Hi percy... Thanks for this informative video on ansible modules. Can you please tell us about "cron" module too.
@toptechskills
@toptechskills 5 жыл бұрын
Hi Jayshree, thanks for your comment, a few people have asked about the cron module, I will try to make a video for this useful module soon.
@tamim2996
@tamim2996 4 жыл бұрын
Percy i must say your video is great....but for begginer it will be difficult to start...is it possible to add 1-2 introductory video to understand host, variavle, playbook etc. more specifically where to put what and how they connect each other...TIA
@toptechskills
@toptechskills 4 жыл бұрын
Hi Tamim, I hope to make some more introductory videos in future. In the meantime however, I can recommend Jeff Geerling's book "Ansible for DevOps" for a good introduction to these concepts. Sorry I can't help more, good luck.
@eddie77084
@eddie77084 4 жыл бұрын
Hi Percy...Thanks for your great videos! How would your host file look if those were two CentOS machines instead of one being Ubuntu?
@toptechskills
@toptechskills 4 жыл бұрын
Hi Edward, thanks for your comment. Your file would look something like this: ``` [centos] centos_host1 ansible_host=1.1.1.1 centos_host2 ansible_host=1.1.1.2 ```
@jayakishoreudayagiri261
@jayakishoreudayagiri261 4 жыл бұрын
@Percy Grunwald from TopTechSkills, Could you please let me know how u setup ssh to those hosts without asking password, did you copy ssh key to those hosts? could you please do videos on Windows modules like mount NAS on windows server & execute commands on windows server
@toptechskills
@toptechskills 4 жыл бұрын
The hosts are in AWS EC2 and I've uploaded my personal SSH key as an EC2 keypair so that when the instances are launched the default user already has my personal SSH key in its authorized_keys. Check out this article for more info: docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#how-to-generate-your-own-key-and-import-it-to-aws. I'd definitely like to make videos on Windows in the future. Thanks for your comment, hope that was helpful.
@melontrophy7483
@melontrophy7483 4 жыл бұрын
I can't seem to access my ubuntu server from alpine linux using ssh. I keep getting the permission denied error (publickey, keyboard-interactive). I tried everything I saw on Google but nothing worked. How do i set up my SSH keys? or maybe my ip address is wrong, how do i know the ip address in my remote host?
@toptechskills
@toptechskills 4 жыл бұрын
Hi, how did you get your Ubuntu server? If it's through some service like AWS, the service itself will give you the IP of your host in the console. The fact that you're getting a permission denied error implies to me that the server you're trying to connect to is up and responding to SSH (which is a good sign). If the instance was created in AWS EC2, you would have selected a keypair to launch the instance with, this keypair would need to be loaded into your SSH agent with `ssh-add` or by using the `-i` argument to the `ssh` command to specify the identity/key to try to connect with.
@kajalrai6681
@kajalrai6681 5 жыл бұрын
Which editor are you using to write a script?
@toptechskills
@toptechskills 5 жыл бұрын
I'm using Visual Studio Code with the Ansible plugin by Microsoft. Highly recommend it.
@kajalrai6681
@kajalrai6681 5 жыл бұрын
How to run .yml file and can I create a file using vim editor.
@toptechskills
@toptechskills 5 жыл бұрын
You run Ansible playbooks with the "ansible-playbook" command. You can definitely use vim for writing Ansible roles and playbooks.
@rickhighness5539
@rickhighness5539 6 жыл бұрын
What editor are you using for your demos?
@toptechskills
@toptechskills 6 жыл бұрын
Hi Rick, I'm using Visual Studio Code with the Ansible extension by Microsoft. code.visualstudio.com marketplace.visualstudio.com/items?itemName=vscoss.vscode-ansible Thanks for watching, hope you enjoyed the video.
@noblenetdk
@noblenetdk 4 жыл бұрын
Super
@toptechskills
@toptechskills 4 жыл бұрын
Thanks Kim 🙏
@dh00mketu
@dh00mketu Жыл бұрын
Why do you use inventory directory instead of just a file? Also, great tutorial ✌
@toptechskills
@toptechskills 11 ай бұрын
That's a good question, I guess for me it's a matter of habit because of my work over the years. We've often ended up with multiple different inventories for different environments or providers. With a directory, you can keep all those different inventories in one place.
@johnfinny100
@johnfinny100 4 жыл бұрын
Could you please share me distribute ssh key to multiple servers video, so i can ssh to all servers.
@toptechskills
@toptechskills 4 жыл бұрын
Hi John, I imported my SSH key as an AWS EC2 keypair and use that to start the instances, so my personal SSH key allows me to log in by default when launching an instance. Check this out for more info: docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#how-to-generate-your-own-key-and-import-it-to-aws
@JackReacher1
@JackReacher1 3 жыл бұрын
I am able to connect using my private key to both the instances but I get this error with the same setup which 2 ubuntu instances on aws $ ansible-playbook file.yml PLAY [run task on all hosts] *************************************************** TASK [Gathering Facts] ********************************************************* fatal: [ubuntu_1]: UNREACHABLE! => {"changed": false, "msg": "Data could not be sent to remote host \"\". Make sure this host can be reached over ssh: ubuntu@: Permission denied (publickey). ", "unreachable": true} fatal: [ubuntu_2]: UNREACHABLE! => {"changed": false, "msg": "Data could not be sent to remote host \"\". Make sure this host can be reached over ssh: ubuntu@: Permission denied (publickey). ", "unreachable": true} PLAY RECAP ********************************************************************* ubuntu_1 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 ubuntu_2 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 I was able to use ssh with my pem key but running file.yml provides me with this error, please help.
@toptechskills
@toptechskills 3 жыл бұрын
Looks like the issue is that it's trying to connect to a hosts "public_ip" and "public_ip_2". These would either need to be set up as aliases for hosts in your ~/.ssh/config file or as aliases for IPs in your /etc/hosts file. Most likely what's going on here is that your Ansible inventory is not configured correctly and you may be trying to use a variable for the value of `ansible_host`, which is not possible (docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#inventory-aliases). If you share your inventory entries for these 2 hosts, I can provide more specific advice. Hope that helps, thanks.
@JackReacher1
@JackReacher1 3 жыл бұрын
@@toptechskills My Host file is: [ubuntu] ansible_user=ubuntu ansible_user=ubuntu I was able to connect to the instances and run the plays but I have to use this command to run the playbook: ansible-playbook --private-key ansible.pem file.yml I have to mention the private key in the command, how are you able to run the playbook without this?
@toptechskills
@toptechskills 3 жыл бұрын
Ah I see, in that case I'd suggest doing the setup in your ~/.ssh/config to specify the identity file for the hosts there so you don't need to specify it for Ansible directly. Ansible uses SSH to connect to the instances and will apply your SSH config when doing so, so any settings you apply there will also be applied. For example # ~/.ssh/config Host , IdentityFile /path/to/ansible.pem User ubuntu # ./inventory/hosts.ini [ubuntu] The SSH config will apply your private key and also set the user for you, so this doesn't need to be set in Ansible. Hope that helps.
@vishnubysani1
@vishnubysani1 4 жыл бұрын
Hello Percy, Your tutorials are amazing. Thanks. Today, I see that Ansible plugin is now RETIRED. Any other GUI options ? marketplace.visualstudio.com/items?itemName=vscoss.vscode-ansible&ssr=false#overview
@toptechskills
@toptechskills 4 жыл бұрын
Thank you for your comment, I saw this as well. I have switched to using github.com/haad/vs-language-ansible as it's the next most popular extension for Ansible. It seems fine so far, maybe you could give it a go and let me know how your experience is. Thanks!
@vishnubysani1
@vishnubysani1 4 жыл бұрын
@@toptechskills Thanks for the reply Percy. Will try it and update
@vishnubysani1
@vishnubysani1 4 жыл бұрын
Hi Percy, I am working on mac where VS is installed. My Ansible controller is AWS VM and I have two control nodes on AWS. Is it possible to run a playbook from my mac on AWS controller VM ? Thanks, Vishnu
@toptechskills
@toptechskills 3 жыл бұрын
In that case, your Mac becomes the control machine and the AWS host is the target. This is perfectly normal and there should be no issues with that. That said, you'll just need to make sure that you can access your AWS host from your Mac via SSH. In AWS, that will require you to configure the security groups to allow inbound connections from your Mac and ensure that you have your SSH authentication set up properly. Is there something you've tried that didn't work?
Ansible Fetch Module Tutorial - Complete Beginner's Guide
9:17
Percy Grunwald from TopTechSkills
Рет қаралды 12 М.
Getting Started with Ansible | Basic Installation and Setup
28:06
Akamai Developer
Рет қаралды 29 М.
We Need to Talk About 8GB Graphics Cards…
6:19
ProYamYamPC
Рет қаралды 3,8 М.
Ansible File Module Tutorial - Complete Beginner's Guide
15:20
Percy Grunwald from TopTechSkills
Рет қаралды 28 М.
Ansible for Windows - Easy Setup!
13:12
Cloud Advocate
Рет қаралды 74 М.
Ansible - Your complete guide to Ansible
17:28
DevOps Journey
Рет қаралды 23 М.
Ansible Apt Module Tutorial - Complete Beginner's Guide
12:01
Percy Grunwald from TopTechSkills
Рет қаралды 6 М.
Rapidly Build & Test Ansible Roles with Molecule + Docker
20:58
Percy Grunwald from TopTechSkills
Рет қаралды 31 М.
Full NixOS Guide: Everything You Need to Know in One Place!
30:11
Make your Ansible playbooks flexible, maintainable, and scalable
47:26
Ansible Playbook for Cisco IOS Upgrade
18:48
Roger Perkin
Рет қаралды 24 М.
Ansible Command Module Tutorial - Complete Beginner's Guide
10:11
Percy Grunwald from TopTechSkills
Рет қаралды 13 М.