{"id":9474,"date":"2025-11-13T00:00:38","date_gmt":"2025-11-12T18:30:38","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=9474"},"modified":"2025-11-13T00:01:09","modified_gmt":"2025-11-12T18:31:09","slug":"how-to-create-and-use-an-ansible-playbook","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/","title":{"rendered":"How to Create and Use an Ansible Playbook"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>In the modern DevOps landscape, <strong>automation<\/strong> is the backbone of efficient infrastructure management. Handling multiple servers manually over SSH can be tedious, error-prone, and time-consuming.<\/p>\n\n\n\n<p>That\u2019s where <strong>Ansible<\/strong> comes in\u2014an <strong>open-source automation tool<\/strong> developed by Red Hat. It helps you <strong>configure servers<\/strong>, <strong>deploy applications<\/strong>, and <strong>manage systems<\/strong> seamlessly using simple <strong>YAML-based playbooks<\/strong>.<\/p>\n\n\n\n<p>In this guide, we\u2019ll walk you through\u2014<strong>step-by-step<\/strong>\u2014how to create, configure, and run your first Ansible playbook using a <strong>control node<\/strong> and <strong>managed nodes<\/strong> setup.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>Before getting started, make sure you have:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Control Node<\/strong>\u2014the main system where Ansible is installed and from which commands are run.<br>Example: <code>Ubuntu 22.04 server<\/code><\/li>\n\n\n\n<li><strong>Managed Nodes<\/strong>\u2014one or more remote servers to be configured using Ansible.<br>Example: <code>2 Ubuntu 22.04 servers<\/code><\/li>\n\n\n\n<li><strong>SSH access<\/strong>\u2014the control node must connect to each managed node using SSH.<\/li>\n\n\n\n<li><strong>Python is installed<\/strong> on the managed nodes (Ansible uses it to run tasks).<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Install Ansible on the Control Node<\/h2>\n\n\n\n<p>First, log in to your <strong>control node<\/strong> and install Ansible:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install ansible -y<\/code><\/pre>\n\n\n\n<p>Verify the installation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ansible --version<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Set Up SSH Connectivity Between Nodes<\/h2>\n\n\n\n<p>To allow the control node to manage other servers, set up <strong>passwordless SSH authentication<\/strong>.<\/p>\n\n\n\n<p>From the <strong>control node<\/strong>, run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-keygen -t rsa<\/code><\/pre>\n\n\n\n<p>Press <strong>Enter<\/strong> to accept defaults (no passphrase required).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Manual Key Setup<\/h2>\n\n\n\n<p>On the control node:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/root\/.ssh\/id_rsa.pub<\/code><\/pre>\n\n\n\n<p>Copy the full line (it starts with <code>ssh-rsa<\/code> or <code>ssh-ed25519<\/code>).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">On the managed node:<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir -p \/home\/ubuntu\/.ssh\nsudo nano \/home\/ubuntu\/.ssh\/authorized_keys<\/code><\/pre>\n\n\n\n<p>Paste your public key inside the file.<\/p>\n\n\n\n<p>Then fix permissions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chown -R ubuntu:ubuntu \/home\/ubuntu\/.ssh\nsudo chmod 700 \/home\/ubuntu\/.ssh\nsudo chmod 600 \/home\/ubuntu\/.ssh\/authorized_keys<\/code><\/pre>\n\n\n\n<p>Now you can log in <strong>without a password<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh ubuntu@43.204.211.35<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Configure the Inventory File<\/h2>\n\n\n\n<p>The inventory file tells Ansible which servers to manage.<br>By default, it\u2019s located at <code>\/etc\/ansible\/hosts<\/code>.<\/p>\n\n\n\n<p>Open it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vi \/etc\/ansible\/hosts<\/code><\/pre>\n\n\n\n<p>Add your managed node(s):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;webservers]\n172.31.0.241 ansible_user=ubuntu ansible_ssh_private_key_file=\/root\/.ssh\/id_rsa\n172.31.14.164 ansible_user=ubuntu ansible_ssh_private_key_file=\/root\/.ssh\/id_rsa<\/code><\/pre>\n\n\n\n<p>Run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ansible all -m ping<\/code><\/pre>\n\n\n\n<p>If everything is configured correctly, you\u2019ll see:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" width=\"792\" height=\"352\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4.png\" alt=\"\" class=\"wp-image-9475\" style=\"width:608px;height:auto\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4.png 792w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4-300x133.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4-768x341.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4-675x300.png 675w\" sizes=\"auto, (max-width: 792px) 100vw, 792px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Create a Directory for Your Playbooks<\/h2>\n\n\n\n<p>It\u2019s best practice to keep playbooks organized in their own directory.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p ~\/ansible\/playbooks\ncd ~\/ansible\/playbooks<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Create the Apache Setup Playbook<\/h2>\n\n\n\n<p>Create a new playbook file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi apache_setup.yml<\/code><\/pre>\n\n\n\n<p>Paste the following YAML code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>---\n- name: Install and configure Apache web server\n  hosts: webservers\n  become: yes\n  tasks:\n    - name: Install Apache\n      apt:\n        name: apache2\n        state: present\n        update_cache: yes\n\n    - name: Start and enable Apache service\n      service:\n        name: apache2\n        state: started\n        enabled: yes\n\n    - name: Deploy custom index.html\n      copy:\n        dest: \/var\/www\/html\/index.html\n        content: \"&lt;h1&gt;Hello from Ansible Apache Playbook!&lt;\/h1&gt;\"<\/code><\/pre>\n\n\n\n<p>Save and exit<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Run the Playbook<\/h2>\n\n\n\n<p>Run the playbook:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ansible-playbook -i \/etc\/ansible\/hosts ~\/ansible\/playbooks\/apache_setup.yml<\/code><\/pre>\n\n\n\n<p>Ansible will:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Connect to all hosts under <code>[webservers]<\/code><\/li>\n\n\n\n<li>Install Apache<\/li>\n\n\n\n<li>Enable and start the Apache service<\/li>\n\n\n\n<li>Deploy your <code>index.html<\/code> file<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-6.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"353\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-6-1024x353.png\" alt=\"\" class=\"wp-image-9477\" style=\"width:622px;height:auto\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-6-1024x353.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-6-300x103.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-6-768x265.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-6-1536x530.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-6-850x293.png 850w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-6.png 1595w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 7: Verify the Result<\/h2>\n\n\n\n<p>From your browser, visit:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:\/\/&lt;your-managed-node-IP&gt;\/<\/code><\/pre>\n\n\n\n<p>You should see:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"762\" height=\"233\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-5.png\" alt=\"\" class=\"wp-image-9476\" style=\"width:509px;height:auto\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-5.png 762w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-5-300x92.png 300w\" sizes=\"auto, (max-width: 762px) 100vw, 762px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 8: Understanding Idempotency<\/h2>\n\n\n\n<p>A powerful feature of Ansible is <strong>idempotency<\/strong> \u2014<br>You can run the same playbook multiple times, and Ansible will only make changes if something actually needs to be updated.<\/p>\n\n\n\n<p>Try rerunning:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ansible-playbook -i \/etc\/ansible\/hosts ~\/ansible\/playbooks\/apache_setup.yml<\/code><\/pre>\n\n\n\n<p>You\u2019ll see most tasks marked as <code>ok<\/code>, meaning no unnecessary actions were performed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-7.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"374\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-7-1024x374.png\" alt=\"\" class=\"wp-image-9478\" style=\"width:598px;height:auto\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-7-1024x374.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-7-300x110.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-7-768x280.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-7-822x300.png 822w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-7.png 1468w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>Ansible makes automation simple, consistent, and scalable.<br>In this guide, we explored how to set up Ansible from scratch\u2014from configuring SSH connectivity and defining an inventory to writing and executing your first playbook that installs and manages Apache on remote servers.<\/p>\n\n\n\n<p>By using Ansible, you eliminate the need for repetitive manual tasks. Its <strong>idempotent nature<\/strong> ensures your servers always remain in the desired state, no matter how many times you run the same playbook.<\/p>\n\n\n\n<p>Ansible is not just a tool\u2014it\u2019s a gateway to <strong>modern DevOps practices<\/strong> and <strong>Infrastructure as Code (IaC)<\/strong>.<br>Keep experimenting, keep automating, and take the first step toward a fully automated infrastructure<\/p>\n\n\n\n<p><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In the modern DevOps landscape, automation is the backbone of efficient infrastructure management. Handling multiple servers manually over SSH can be tedious, error-prone, and time-consuming. That\u2019s where Ansible comes in\u2014an open-source automation tool developed by Red Hat. It helps you configure servers, deploy applications, and manage systems seamlessly using&hellip; <a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/\" class=\"more-link read-more\" rel=\"bookmark\">Continue Reading <span class=\"screen-reader-text\">How to Create and Use an Ansible Playbook<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":510,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1],"tags":[999,1000],"class_list":{"0":"post-9474","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-uncategorized","7":"tag-ansible-playbook","8":"tag-create-a-ansible-playbook","9":"h-entry","11":"h-as-article"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pheonix Solutions - We Empower Your Business Growth<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pheonix Solutions - We Empower Your Business Growth\" \/>\n<meta property=\"og:description\" content=\"Introduction In the modern DevOps landscape, automation is the backbone of efficient infrastructure management. Handling multiple servers manually over SSH can be tedious, error-prone, and time-consuming. That\u2019s where Ansible comes in\u2014an open-source automation tool developed by Red Hat. It helps you configure servers, deploy applications, and manage systems seamlessly using&hellip; Continue Reading How to Create and Use an Ansible Playbook\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/\" \/>\n<meta property=\"og:site_name\" content=\"PHEONIXSOLUTIONS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-11-12T18:30:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-12T18:31:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4.png\" \/>\n\t<meta property=\"og:image:width\" content=\"792\" \/>\n\t<meta property=\"og:image:height\" content=\"352\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Naveen Prasad\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:site\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Naveen Prasad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/\"},\"author\":{\"name\":\"Naveen Prasad\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/7e0b107d557060d31788b0abd1965e55\"},\"headline\":\"How to Create and Use an Ansible Playbook\",\"datePublished\":\"2025-11-12T18:30:38+00:00\",\"dateModified\":\"2025-11-12T18:31:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/\"},\"wordCount\":509,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/image-4.png\",\"keywords\":[\"ansible playbook\",\"create a ansible playbook\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/\",\"name\":\"Pheonix Solutions - We Empower Your Business Growth\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/image-4.png\",\"datePublished\":\"2025-11-12T18:30:38+00:00\",\"dateModified\":\"2025-11-12T18:31:09+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/#primaryimage\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/image-4.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/11\\\/image-4.png\",\"width\":792,\"height\":352},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-and-use-an-ansible-playbook\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create and Use an Ansible Playbook\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"name\":\"Pheonix Solutions\",\"description\":\"We Empower Your Business Growth\",\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\",\"name\":\"PheonixSolutions\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"width\":454,\"height\":300,\"caption\":\"PheonixSolutions\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/PheonixSolutions-209942982759387\\\/\",\"https:\\\/\\\/x.com\\\/pheonixsolution\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/7e0b107d557060d31788b0abd1965e55\",\"name\":\"Naveen Prasad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g\",\"caption\":\"Naveen Prasad\"},\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/author\\\/naveen-prasad\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pheonix Solutions - We Empower Your Business Growth","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/","og_locale":"en_US","og_type":"article","og_title":"Pheonix Solutions - We Empower Your Business Growth","og_description":"Introduction In the modern DevOps landscape, automation is the backbone of efficient infrastructure management. Handling multiple servers manually over SSH can be tedious, error-prone, and time-consuming. That\u2019s where Ansible comes in\u2014an open-source automation tool developed by Red Hat. It helps you configure servers, deploy applications, and manage systems seamlessly using&hellip; Continue Reading How to Create and Use an Ansible Playbook","og_url":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/","og_site_name":"PHEONIXSOLUTIONS","article_publisher":"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","article_published_time":"2025-11-12T18:30:38+00:00","article_modified_time":"2025-11-12T18:31:09+00:00","og_image":[{"width":792,"height":352,"url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4.png","type":"image\/png"}],"author":"Naveen Prasad","twitter_card":"summary_large_image","twitter_creator":"@pheonixsolution","twitter_site":"@pheonixsolution","twitter_misc":{"Written by":"Naveen Prasad","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/#article","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/"},"author":{"name":"Naveen Prasad","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/7e0b107d557060d31788b0abd1965e55"},"headline":"How to Create and Use an Ansible Playbook","datePublished":"2025-11-12T18:30:38+00:00","dateModified":"2025-11-12T18:31:09+00:00","mainEntityOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/"},"wordCount":509,"commentCount":0,"publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/#primaryimage"},"thumbnailUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4.png","keywords":["ansible playbook","create a ansible playbook"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/","url":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/","name":"Pheonix Solutions - We Empower Your Business Growth","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/#primaryimage"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/#primaryimage"},"thumbnailUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4.png","datePublished":"2025-11-12T18:30:38+00:00","dateModified":"2025-11-12T18:31:09+00:00","breadcrumb":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/#primaryimage","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/11\/image-4.png","width":792,"height":352},{"@type":"BreadcrumbList","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-and-use-an-ansible-playbook\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pheonixsolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Create and Use an Ansible Playbook"}]},{"@type":"WebSite","@id":"https:\/\/pheonixsolutions.com\/blog\/#website","url":"https:\/\/pheonixsolutions.com\/blog\/","name":"Pheonix Solutions","description":"We Empower Your Business Growth","publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pheonixsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pheonixsolutions.com\/blog\/#organization","name":"PheonixSolutions","url":"https:\/\/pheonixsolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","width":454,"height":300,"caption":"PheonixSolutions"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","https:\/\/x.com\/pheonixsolution"]},{"@type":"Person","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/7e0b107d557060d31788b0abd1965e55","name":"Naveen Prasad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g","caption":"Naveen Prasad"},"url":"https:\/\/pheonixsolutions.com\/blog\/author\/naveen-prasad\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7F4uM-2sO","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/510"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=9474"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9474\/revisions"}],"predecessor-version":[{"id":9479,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9474\/revisions\/9479"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=9474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=9474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=9474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}