Ansible Fundamentals
Ansible is an agentless automation tool that configures systems, deploys software, and orchestrates multi-step tasks over SSH or WinRM. You describe desired state in YAML playbooks, and Ansible pushes the necessary changes to target machines without requiring a resident agent.
itInfrastructure and operations | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Ansible Fundamentals
Nothing called Ansible runs on the machines Ansible manages. There is a control node with the tooling on it, a list naming what to talk to, and a connection — SSH mostly, PowerShell remoting for Windows — down which code is pushed, executed and reported on.
Most of the tool's character follows: nothing to install across a fleet, nothing to keep alive, and equally nothing watching in between runs.
The second thing worth internalising is what a task is. A shell script says what to execute. A task says what ought to be true — this package present, this service running, this file with these contents — and the module doing the work checks the current state before acting, so a second run over an already-correct machine reports nothing done.
That property is idempotency: running the same thing twice leaves the same
result, which is what makes repetition safe rather than a gamble. It belongs to
individual modules, not to the tool as a whole. Reach for command or shell,
which run something and check nothing, and it has quietly been opted out of.
The shape underneath is a pipeline. What the inventory matches is the blast radius, which is why it gets inspected before anything else. A play attaches an ordered task list to a group of hosts, each task hands work to a module, and each module answers ok, changed or failed.
Those answers are what later work keys off — chiefly handlers, tasks that fire only because something upstream genuinely changed. Deploy an identical config and the restart never happens: either elegant, or precisely why a service failed to restart.
Three things nobody says early enough. There is no transaction anywhere in this. A run across two hundred machines ends with a hundred and ninety changed, seven unreachable and three failed, and nothing rolls back the hundred and ninety.
The fleet is now in mixed condition and the next run starts from there, so the design question for any playbook is what it looks like stopped halfway. Read the unreachable column of the summary first: it counts machines the automation has silently stopped describing.
Second, changed is the only signal the tool emits, and it is spendable. A
playbook reporting a change on every run carries no information, a genuine
surprise hides in it perfectly, and within weeks nobody reads the summary.
Third, the wall is runtime rather than syntax. By default only five machines are worked on at once, and the default strategy waits for all five to finish a task before starting the next, so the slowest in each batch sets the pace — and collecting facts about every machine charges for that before the first real task runs. Raising the parallelism, reusing connections and caching those facts are the levers. The shipped defaults assume a laptop.
One more, because it otherwise costs an afternoon: a variable can be set in twenty-two places with a defined override order, which is why "where did this value come from" stops being answerable by reading. Define each in one place.
Commands and the safe-run sequence are on the Cheatsheet, the model is set out in full in the Intro, and Field Notes has the one ratio worth tracking.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://docs.ansible.com/projects/ansible/latest/getting_started/index.html
Supports
- Control node, inventory, and managed node as the three core environment components
- Ansible manages remote systems toward desired state
- https://docs.ansible.com/projects/ansible/latest/getting_started/basic_concepts.html
Supports
- Plays map managed nodes to ordered tasks
- Modules, plugins, collections, roles, and handlers have distinct responsibilities
- Managed nodes do not normally have Ansible installed
- https://docs.ansible.com/projects/ansible/latest/installation_guide/intro_installation.html
Supports
- Agentless control-node architecture and supported transports
- Managed-node runtime requirements and documented exceptions
- ansible-core and Ansible package distinction
- https://docs.ansible.com/projects/ansible/latest/inventory_guide/intro_inventory.html
Supports
- Static and dynamic inventory sources
- Hosts, groups, variables, connection parameters, and multiple group membership
- YAML and INI inventory formats
- https://docs.ansible.com/projects/ansible/latest/inventory_guide/intro_patterns.html
Supports
- Host and group selection through patterns
- Pattern intersection and interaction with command-line limits
- https://docs.ansible.com/projects/ansible/latest/playbook_guide/playbooks_intro.html
Supports
- Ordered play and task execution
- Fully qualified collection name recommendation
- Desired state, idempotency, execution results, and verification options
- https://docs.ansible.com/projects/ansible/latest/playbook_guide/playbooks_variables.html
Supports
- Variable definitions, scope, use in playbooks, and Jinja expressions
- https://docs.ansible.com/projects/ansible/latest/playbook_guide/playbooks_vars_facts.html
Supports
- Facts as discovered managed-node data exposed through variables
- Fact gathering, disabling, and caching concepts
- https://docs.ansible.com/projects/ansible/latest/playbook_guide/playbooks_handlers.html
Supports
- Handlers run when changed tasks notify them
- Notification deduplication and handler execution timing
- Change reporting controls operational reactions
- https://docs.ansible.com/projects/ansible/latest/playbook_guide/playbooks_checkmode.html
Supports
- Check mode and diff mode behavior
- Limits for unsupported modules and registered-result dependencies
- Sensitive-data risk in diff output
- https://docs.ansible.com/projects/ansible/latest/reference_appendices/general_precedence.html
Supports
- Configuration, command-line, keyword, variable, and direct-assignment precedence categories
- ansible.cfg search order and first-file behavior
- Extra variables as high-precedence values
- https://docs.ansible.com/projects/ansible/latest/playbook_guide/playbooks_reuse_roles.html
Supports
- Role directory structure and reusable content categories
- Role defaults, variables, tasks, handlers, files, and templates
- https://docs.ansible.com/projects/ansible/latest/collections_guide/index.html
Supports
- Collections as namespaced distributions of playbooks, roles, modules, and plugins
- Collection installation and use through distribution servers
- https://docs.ansible.com/projects/ansible/latest/vault_guide/index.html
Supports
- Ansible Vault encryption for variables and files at rest
- Limits of Vault protection after content is decrypted
- https://docs.ansible.com/projects/ansible/latest/cli/ansible-playbook.html
Supports
- Current syntax-check, list-hosts, list-tasks, check, diff, limit, tags, become, and verbosity options
- ansible-playbook executes defined tasks on targeted hosts
- https://docs.ansible.com/projects/ansible/latest/cli/ansible.html
Supports
- Ad hoc module execution, inventory selection, module arguments, and verbosity options
- Version output and CLI configuration discovery
- https://docs.ansible.com/projects/ansible/latest/cli/ansible-config.html
Supports
- Inspecting effective configuration and changed settings
- https://docs.ansible.com/projects/ansible/latest/cli/ansible-doc.html
Supports
- Inspecting installed module and plugin documentation
- https://docs.ansible.com/projects/ansible/latest/cli/ansible-inventory.html
Supports
- Displaying inventory as a graph, list, or host-specific view
- https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/ping_module.html
Supports
- Verifying login and usable remote Python rather than ICMP reachability
- https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/package_module.html
Supports
- Generic package state management and supported state values
- https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/file_module.html
Supports
- File, directory, link, ownership, mode, and absence management
- https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/copy_module.html
Supports
- Copying static content with destination ownership and mode controls
- https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/template_module.html
Supports
- Rendering Jinja templates to managed-node destinations
- https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/service_module.html
Supports
- Service state and enablement management
- https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/user_module.html
Supports
- User account state, group, and shell management
- https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/setup_module.html
Supports
- Gathering managed-node facts
- https://docs.ansible.com/projects/ansible/latest/collections/ansible/builtin/assert_module.html
Supports
- Asserting playbook preconditions and invariants
- https://docs.ansible.com/projects/ansible/latest/playbook_guide/playbooks_error_handling.html
Supports
- changed_when and failed_when semantics
- Unreachable and failed host behavior and forced handlers
- https://docs.ansible.com/projects/ansible/latest/playbook_guide/playbooks_tags.html
Supports
- Selecting or skipping tagged plays and tasks
- https://docs.ansible.com/projects/ansible/latest/playbook_guide/playbooks_privilege_escalation.html
Supports
- Become plugins, methods, users, credentials, and task or play scope
