{"id":11394,"date":"2024-02-19T17:57:18","date_gmt":"2024-02-19T12:27:18","guid":{"rendered":"https:\/\/www.skynats.com\/?p=11394"},"modified":"2024-02-21T19:24:19","modified_gmt":"2024-02-21T13:54:19","slug":"how-to-install-and-configure-ansible-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/how-to-install-and-configure-ansible-on-ubuntu-22-04\/","title":{"rendered":"How To Install and Configure Ansible on Ubuntu 22.04?"},"content":{"rendered":"<p><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/ansible.png\" sizes=\"(max-width: 318px) 100vw, 318px\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/ansible.png 318w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/ansible-300x150.png 300w\" alt=\"install and configure ansible on ubuntu 22\" width=\"318\" height=\"159\" \/><\/p>\n\n\n<p class=\"wp-block-paragraph\">Ansible is a free and open-source automation tool used to configuration management, application deployment and task automation. We at Skynats do Ansible automations for various tasks under our <a href=\"https:\/\/www.skynats.com\/server-management\/\">Server Management<\/a> plan.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To install Ansible on your server, run the following command on your control node:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install software-properties-common\nsudo add-apt-repository --yes --update ppa:ansible\/ansible\nsudo apt install ansible<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verify the installation by using the command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ansible --version<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"602\" height=\"133\" sizes=\"(max-width: 602px) 100vw, 602px\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/Screenshot-2024-02-19-at-5.51.12\u202fPM.png\" alt=\"\" class=\"wp-image-11400\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/Screenshot-2024-02-19-at-5.51.12\u202fPM.png 602w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/Screenshot-2024-02-19-at-5.51.12\u202fPM-300x66.png 300w\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After that, create a user to perform Ansible tasks on both the control and managed node and give the sudo permissions.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo adduser ansible<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Configure password less authentication for the created user from control node to managed nodes. For that, generate an SSH key pair and copy it to the managed nodes using the following commands.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-keygen\nssh-copy-id ansible@192.168.2.1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then, add the managed nodes IP addresses to the Ansible inventory file located in the \/etc\/ansible directory.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/ansible\/hosts<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add managed nodes IP addresses, then save and quit the inventory file. To list the managed nodes added in above step, run the command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ansible all -i hosts --list-hosts<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">All managed nodes added will be listed as shown below<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"601\" height=\"28\" sizes=\"(max-width: 601px) 100vw, 601px\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/Screenshot-2024-02-19-at-5.53.41\u202fPM.png\" alt=\"\" class=\"wp-image-11401\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/Screenshot-2024-02-19-at-5.53.41\u202fPM.png 601w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/02\/Screenshot-2024-02-19-at-5.53.41\u202fPM-300x14.png 300w\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We have now completed the Ansible installation and configuration. Next, we can verify the configuration by using the ping command from the Ansible control node to ensure that the managed nodes are available.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ansible -m ping all<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the output displayed was success, which means that managed nodes are available and we can perform the tasks using Ansible automation tool.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our\u00a0<a href=\"https:\/\/www.skynats.com\/server-management\/\">Technical Team<\/a>\u00a0will be available to assist you with Ansible automation tool services that can make your job a lot easier. Get in touch with\u00a0<a href=\"https:\/\/www.skynats.com\/server-management\/\">Skynats<\/a>\u00a0if you have any queries.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ansible is a free and open-source automation tool used to configuration management, application deployment and task automation. We at Skynats do Ansible automations for various tasks under our Server Management plan. To install Ansible on your server, run the following command on your control node: Verify the installation by using the command After that, create [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,796],"tags":[147,149,72,22],"class_list":["post-11394","post","type-post","status-publish","format-standard","hentry","category-blog","category-ansible-automation","tag-advantages-of-ansible","tag-ansible-automation","tag-server-management","tag-server-support"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/11394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=11394"}],"version-history":[{"count":0,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/11394\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=11394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=11394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=11394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}