<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Peter Anyankpele — DevOps & Cloud Platform Engineering]]></title><description><![CDATA[Technical insights and practical guides on DevOps, cloud engineering, infrastructure automation, CI/CD, Kubernetes, and AI engineering.]]></description><link>https://peteranyankpele.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1593680282896/kNC7E8IR4.png</url><title>Peter Anyankpele — DevOps &amp; Cloud Platform Engineering</title><link>https://peteranyankpele.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Fri, 09 Oct 2026 08:39:01 GMT</lastBuildDate><atom:link href="https://peteranyankpele.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How Ansible Works: From Inventory to Repeatable Infrastructure Automation]]></title><description><![CDATA[Introduction
Infrastructure automation becomes increasingly important as systems grow beyond a small number of servers. What may begin as a few manual configuration steps can quickly become difficult ]]></description><link>https://peteranyankpele.hashnode.dev/how-ansible-works-from-inventory-to-repeatable-infrastructure-automation</link><guid isPermaLink="true">https://peteranyankpele.hashnode.dev/how-ansible-works-from-inventory-to-repeatable-infrastructure-automation</guid><category><![CDATA[ansible]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Cloud]]></category><category><![CDATA[cloud infrastructure automation]]></category><category><![CDATA[ci-cd]]></category><dc:creator><![CDATA[Peter Anyankpele]]></dc:creator><pubDate>Wed, 23 Sep 2026 13:25:17 GMT</pubDate><content:encoded><![CDATA[<p>Introduction</p>
<p>Infrastructure automation becomes increasingly important as systems grow beyond a small number of servers. What may begin as a few manual configuration steps can quickly become difficult to manage when environments expand across development, testing, and production.</p>
<p>Ansible provides a way to turn those manual procedures into repeatable automation. Instead of configuring each server individually, you define the desired configuration in an inventory and playbooks, then let Ansible execute those instructions across the systems you manage.</p>
<p>This article explains how Ansible works from the ground up, using a practical workflow that covers its architecture, inventory, playbooks, execution model, idempotency, CI/CD integration, security, and validation.</p>
<p>The goal is not simply to describe Ansible commands, but to show how the different pieces fit together to create a repeatable infrastructure automation process.</p>
<p>The Hidden Cost of Manual Configuration</p>
<p>Before automation, server configuration is often handled manually. An engineer may connect to one server, install packages, modify configuration files, start services, and then repeat the same process on another server.</p>
<p>This approach can work at small scale, but it introduces several problems:</p>
<ul>
<li><p>Manual server-by-server work</p>
</li>
<li><p>Configuration drift between environments</p>
</li>
<li><p>Human error during repetitive changes</p>
</li>
<li><p>Slow recovery when a system needs to be rebuilt or corrected</p>
</li>
</ul>
<p>The more systems that need to remain consistent, the harder it becomes to rely on memory and manual procedures.</p>
<p>Automation addresses this by making the desired configuration explicit and repeatable.</p>
<p>What Ansible Changes</p>
<p>Ansible changes the workflow by moving configuration from manual, server-by-server work into structured automation.</p>
<p>The core idea is simple: define what systems should look like, identify the systems that should receive the configuration, and let Ansible perform the required actions.</p>
<p>This provides three practical benefits:</p>
<ul>
<li><p>Consistency — the same configuration can be applied across multiple systems.</p>
</li>
<li><p>Speed — repeatable tasks can be executed without performing every step manually.</p>
</li>
<li><p>Control — configuration becomes visible, reviewable, and easier to manage through version control.</p>
</li>
</ul>
<p>The result is a workflow where infrastructure changes can be treated more like engineering work than a collection of manual server procedures.</p>
<p>How Ansible Works</p>
<p>Ansible follows a straightforward architecture built around a control node, an inventory, playbooks, modules, and managed nodes.</p>
<p>The control node is the system from which Ansible commands and playbooks are executed. The inventory defines the managed systems and organizes them into groups. Playbooks describe the desired configuration and the tasks that should be performed. Modules perform the actual work on the managed nodes.</p>
<p>This separation makes the automation easier to understand and maintain:</p>
<p>Control node → Inventory → Playbook → Modules → Managed nodes</p>
<p>Ansible is designed to be agentless. For Linux and Unix systems, it commonly connects using SSH, while Windows systems can use Windows-specific connection mechanisms such as WinRM or PSRP.</p>
<p>The managed systems do not need a permanent Ansible agent running on them. Ansible connects when work needs to be performed, executes the required modules, and reports the result back to the control node.</p>
<p>Inventory: Defining the Systems Ansible Manages</p>
<p>Ansible needs to know which systems it should manage. The inventory provides that definition.</p>
<p>An inventory can organize hosts into logical groups such as web servers, database servers, development servers, or other infrastructure roles. Variables can also be associated with hosts or groups to provide environment-specific configuration.</p>
<p>A simple inventory might look like this:</p>
<p>[webservers] web1 web2</p>
<p>[database] db1</p>
<p>[development] dev1 dev2</p>
<p>The important idea is that the playbook does not need to contain a hard-coded list of every server. Instead, it can target a group such as webservers, allowing the same automation to be reused as the environment changes.</p>
<p>This separation between inventory and automation logic makes the configuration easier to maintain and extend.</p>
<p>A Practical Ansible Implementation</p>
<p>A practical implementation can connect version control, CI/CD, Ansible, and the managed infrastructure into one workflow.</p>
<p>For example, a developer can change an Ansible configuration and push the change to GitHub. A Jenkins webhook can then trigger the automation process, allowing Jenkins and Ansible to execute the appropriate playbook against selected target groups.</p>
<p>A typical environment can include:</p>
<ul>
<li><p>RHEL web servers</p>
</li>
<li><p>A database server</p>
</li>
<li><p>An NFS server for shared storage</p>
</li>
<li><p>Ubuntu development servers</p>
</li>
<li><p>Other infrastructure targets as required</p>
</li>
</ul>
<p>The flow becomes:</p>
<p>Developer → GitHub → Jenkins + Ansible → Managed Servers</p>
<p>This creates a clear relationship between the configuration change and the infrastructure state that results from it.</p>
<p>Production-Grade Change Flow</p>
<p>In a more controlled environment, the workflow can introduce validation and human approval before production changes are applied.</p>
<p>A typical sequence is:</p>
<ol>
<li><p>An engineer modifies the configuration.</p>
</li>
<li><p>The change is submitted through a pull request.</p>
</li>
<li><p>The repository event triggers the automation workflow.</p>
</li>
<li><p>The change is deployed to the development environment.</p>
</li>
<li><p>The result is validated.</p>
</li>
<li><p>A human approves the production change.</p>
</li>
<li><p>Ansible applies the approved configuration to production.</p>
</li>
</ol>
<p>This approach provides a controlled path from configuration change to infrastructure state.</p>
<p>Version control, approvals, and automation logs also provide an auditable record of how infrastructure changes were introduced.</p>
<p>Playbooks: Declaring the Desired State</p>
<p>Playbooks are where the intended configuration is expressed.</p>
<p>Instead of writing a sequence of low-level commands, a playbook describes the state that the managed system should reach.</p>
<p>For example:</p>
<ul>
<li><p>name: Configure web servers hosts: webservers become: true tasks:</p>
<ul>
<li><p>name: Ensure nginx is installed ansible.builtin.package: name: nginx state: present</p>
</li>
<li><p>name: Ensure nginx is running ansible.builtin.service: name: nginx state: started enabled: true</p>
</li>
</ul>
</li>
</ul>
<p>This playbook declares that nginx should be installed and running on the hosts in the webservers group.</p>
<p>The same pattern can be reused across multiple hosts and environments.</p>
<p>Three important characteristics are worth highlighting:</p>
<p>Declarative</p>
<p>The playbook describes the required state rather than scripting every low-level step.</p>
<p>Reusable</p>
<p>The same automation pattern can target multiple hosts and environments.</p>
<p>Idempotent</p>
<p>When the desired state is already satisfied, a repeat run should avoid unnecessary changes.</p>
<p>Understanding the Execution Flow</p>
<p>When an Ansible playbook runs, several stages happen in sequence.</p>
<p>Load inventory → Parse playbook → Connect → Run modules → Compare state → Report</p>
<p>First, Ansible loads the inventory and determines which hosts are targeted.</p>
<p>It then parses the playbook and identifies the tasks that need to be executed.</p>
<p>Ansible connects to the target systems using the appropriate connection method. It then uses modules to perform the requested operations.</p>
<p>After the modules run, Ansible reports the result of each task.</p>
<p>This is an important distinction:</p>
<p>The playbook expresses the source of intent.</p>
<p>The modules perform the actual work.</p>
<p>Understanding this separation makes it easier to troubleshoot automation when something does not behave as expected.</p>
<p>Idempotency: Why Repeatability Matters</p>
<p>One of Ansible's important operational concepts is idempotency.</p>
<p>Suppose nginx is not installed when a playbook runs for the first time. Ansible installs it and reports that a change was made.</p>
<p>If the same playbook runs again and nginx is already installed and configured as required, Ansible should not perform unnecessary work.</p>
<p>The desired result is therefore repeatable:</p>
<p>First run → configuration changes where required</p>
<p>Second run → no unnecessary changes</p>
<p>This is valuable in operations and CI/CD because automation can be safely rerun after failures, environment changes, or other operational events.</p>
<p>It can also help reduce configuration drift and provide clearer operational evidence through statuses such as changed, ok, and failed.</p>
<p>CI/CD Integration</p>
<p>Ansible becomes even more useful when configuration is treated as code and integrated into a CI/CD workflow.</p>
<p>A practical flow can look like this:</p>
<p>GitHub → Pull Request → Jenkins → Ansible → Servers</p>
<p>GitHub provides version control for inventories and playbooks.</p>
<p>A pull request provides an opportunity to review and approve the proposed configuration change.</p>
<p>Jenkins can receive a repository webhook and perform validation or orchestrate the automation workflow.</p>
<p>Ansible provides the execution layer that applies the approved configuration to the target servers.</p>
<p>This means infrastructure changes can follow an engineering workflow rather than being applied as undocumented manual commands.</p>
<p>A Repeatable Change Workflow</p>
<p>A practical change workflow can be structured as follows:</p>
<ol>
<li>Feature branch</li>
</ol>
<p>Create or update the inventory or playbook in a feature branch.</p>
<ol>
<li>Commit and push</li>
</ol>
<p>Version the configuration change and push it to the repository.</p>
<ol>
<li>Review</li>
</ol>
<p>Use peer review or a pull request to examine the proposed change.</p>
<ol>
<li>Merge</li>
</ol>
<p>Once approved, the change reaches the main branch.</p>
<ol>
<li>CI validation</li>
</ol>
<p>Run validation such as linting, syntax checks, and relevant tests.</p>
<ol>
<li>Ansible run</li>
</ol>
<p>Apply the approved state to the intended target systems.</p>
<p>The important principle is that configuration is treated as code, rather than as a sequence of undocumented server commands.</p>
<p>Security and Operations</p>
<p>Automation also needs a security model.</p>
<p>A common pattern is to use a hardened control node or bastion and restrict who is allowed to execute automation.</p>
<p>Credentials should be handled carefully using mechanisms such as SSH keys, Ansible Vault, managed secrets, and least-privilege accounts.</p>
<p>Target servers can remain on private networks while controlled access is concentrated at the automation layer.</p>
<p>A production-oriented setup should also consider:</p>
<ul>
<li><p>Authenticated webhooks</p>
</li>
<li><p>Protected CI/CD credentials</p>
</li>
<li><p>Separate development, staging, and production inventories</p>
</li>
<li><p>Least-privilege access</p>
</li>
<li><p>Approval controls for high-impact production changes</p>
</li>
</ul>
<p>The objective is not simply to automate access, but to make the automation path controlled and auditable.</p>
<p>Validating an Ansible Run</p>
<p>A successful automation run should provide evidence that the intended configuration was actually applied.</p>
<p>For example, the results should show that:</p>
<ul>
<li><p>Ansible connected to the intended target hosts.</p>
</li>
<li><p>Tasks produced the expected state.</p>
</li>
<li><p>The results were reported clearly.</p>
</li>
<li><p>A rerun produced no unnecessary changes when the desired state was already satisfied.</p>
</li>
</ul>
<p>An important troubleshooting distinction is also required.</p>
<p>An unreachable host is not necessarily the same thing as a playbook failure.</p>
<p>A connection, authentication, networking, or environment problem may prevent Ansible from reaching a target, while a playbook failure means the automation reached the host but a task did not complete as expected.</p>
<p>Separating these failure types makes troubleshooting more systematic.</p>
<p>What Ansible Gives You Beyond Automation</p>
<p>The value of Ansible goes beyond simply making automation work.</p>
<p>Infrastructure as Code</p>
<p>Configuration can be expressed as version-controlled YAML and reviewed like other engineering changes.</p>
<p>Repeatability</p>
<p>The same automation can be executed against grouped hosts and different environments.</p>
<p>CI/CD Integration</p>
<p>Configuration changes can flow from version control through CI into controlled infrastructure workflows.</p>
<p>Secure Access Patterns</p>
<p>A centralized control layer or bastion can provide a controlled route to private servers.</p>
<p>Troubleshooting</p>
<p>Real automation failures provide useful information about access, networking, dependencies, and system configuration.</p>
<p>Together, these practices turn infrastructure configuration into a more structured engineering process.</p>
<p>From a Working Playbook to Enterprise Practice</p>
<p>A working Ansible playbook is a foundation. Production adoption adds governance, security, and scale.</p>
<p>Standardize</p>
<p>Create reusable roles, environment variables, and naming conventions so that automation follows consistent patterns.</p>
<p>Secure</p>
<p>Use Ansible Vault or managed secrets, authenticated webhooks, and least-privilege access.</p>
<p>Govern</p>
<p>Use pull-request approvals, change records, automated testing, and linting.</p>
<p>Scale</p>
<p>Use reusable roles and inventories, scheduled automation where appropriate, monitoring, and reporting.</p>
<p>Organizations can also measure the operational impact of automation using indicators such as deployment time, configuration drift reduction, change failure rate, and recovery effort.</p>
<p>For high-impact production changes, keeping humans in the approval loop can provide an additional operational control.</p>
<p>Conclusion</p>
<p>Ansible provides a practical way to move infrastructure configuration from manual procedures to repeatable automation.</p>
<p>Its architecture is straightforward: a control node manages an inventory of systems, playbooks describe the desired state, modules perform the work, and the results are reported back to the control node.</p>
<p>The real value comes from combining these components with version control, CI/CD, security controls, validation, and operational governance.</p>
<p>When configuration is treated as code, infrastructure changes become easier to review, repeat, troubleshoot, and audit.</p>
<p>The result is not simply faster automation. It is a more structured way to manage infrastructure consistently across development and production environments.</p>
<p>About the Author</p>
<p>Peter Anyankpele is a DevOps and Cloud Platform Engineer with experience across infrastructure automation, cloud platforms, CI/CD, containerization, Kubernetes, and AI engineering.</p>
<p>He works on practical engineering systems that connect software development with reliable infrastructure and automation.</p>
<p>This article is based on his Ansible Configuration Management technical presentation, which explains Ansible architecture, inventory, playbooks, execution, security, CI/CD integration, and repeatable infrastructure practices.</p>
]]></content:encoded></item></channel></rss>