Are you finding difficulty in remembering all the commands that you need in order to work with Ansible?
Guys don’t worry if you are a beginner and have no idea about how Ansible works, this Ansible cheat sheet will give you a quick reference of the basics that you must know to get started.
Prepare yourself for the Top DevOps Interview Questions And Answers!
While at Intellipaat, we support our learners with a handy reference, that’s the reason we have created this Cheat sheet.
This cheat sheet is designed for the one who has already started learning about Ansible but needs a handy reference sheet.
It is an open source engine that automates deployment, orchestration, cloud provisioning and other tools. It uses a playbook to describe jobs and uses YAML which is human readable and is designed for multi- tier deployment. It is agentless and works by connecting nodes through SSH.
Become Master of DevOps by going through this online DevOps training in London.
Ansible does its work by connecting the nodes and pushes small programs called modules to them and are removed when they are done.
If we conclude the above diagram:
Go through the Best DevOps Course in New York to get clear understanding of DevOps.
Before moving forward and working on commands, let’s understand few aspects for environment setup and then we will setup the Ansible Machine.
Let’s discuss the types of machine when we are talking of deployment.
Types of machines:
Multiple remote machines can be handled by one machine, and the remote machine managing is done through ansible by default.
Run Ansible version command to make sure it was installed properly.
Now let’s check the major differences between Agile and DevOps
Before looking into important commands of Ansible, first let’s understands its terms
YAML syntax is used to express the ansible playbooks
Here are some basic concepts of YAML:
Dictionary is represented in key value pair
Each element has to be written in a new line with “-” as the prefix
Lists inside the dictionary:
Learn more about DevOps in this DevOps training in Sydney to get ahead in your career!
An Ad-hoc commands are something that you might type in order to do something really quick, but you don’t want to save them for late, which means those commands need not to be performed later.
General syntax of ad-hoc command:
|Check connectivity of hosts||#ansible <group> -m ping|
|Rebooting hosts||#ansible <group> -a “/bin/reboot”|
|Check host system’s info||#ansible<group> -m steup | less|
|Transfering files||#ansible <group> -m copy -a “src=home/ansible dest=/tmo/home”|
|Create new user||#ansible<group> -m user -a “name=ansible password= <encrypted password>”|
|Deleting user||#ansible<group> -m user -a “name=ansible state- absent”|
|Check if package is installed and update it||#ansible<group> -m yum -a “name=httpd state=latest”|
|Check if package is installed and don’t want to update it||#ansible<group> -m yum -a “name=httpd state=present”|
|Check if package is s specific version||#ansible<group> -m yum -a “name=httpd-1.8 state=latest”|
|Check if package is not installed||#ansible <group> -m yum -a “name= httpd state= absent|
|Starting a service||#ansible<group> -m service -a “name= httpd state=”started”|
|Stopping a service||#ansible<group> -m service -a “name= httpd state=”stopped”|
|Restarting a service||#ansible<group> -m service -a “name= httpd state=”restarted”|
If you have any doubts or Queries related to DevOps, get it clarifies from DevOps Experts on DevOps Community.
It is the place where all YAML files are stored and executed. Acts like a to-do list.
Sample playbook/YAML file:
Some general tags of YAML:
Interested in becoming DevOps Expert? Click here to learn more in this DevOps Course in Toronto!
It is as similar to using variables in programming languages
Here tomcat port is the variable and it has been assigned to Port 8080
Important Keywords used:
Interested in getting an industry-recognized certification in DevOps? Enroll in Intellipaat’s DevOps Course in Bangalore now!
Now, you know the most important skill set of a DevOps Engineer. But, do you know, DevOps Engineers are among the highest paid professionals in the technology domain? so join DevOps training in Hyderabad!
The most common strategies to debugging the playbooks are
Some of its drawbacks are:
Get in touch with Intellipaat for a comprehensive DevOps Training and be a certified DevOps Engineer!
We have covered all the basics of Ansible in this cheat sheet. If you want to start learning DevOps in depth then check out the DevOps Certification by Intellipaat.
Not only will you get to learn and implement Ansible with a step by step guidance and support from us, but you will also get to learn other important topics in DevOps such as Docker, Git/GitHub, Chef, Jenkins, Puppet, Selenium, Nagios and many more. You will also get 24*7 technical support to help you with any and all of your queries, from the experts in the respective technologies here at intellipaat throughout the certification period. So, why wait? Check out the training program and enroll today!Previous Next
Download Interview Questions asked by top MNCs in 2019?