AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,100 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example" published by Apress, and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

Ansible Modules: Complete List & Guide to Built-in Modules (2026)

By Luca Berton · Published 2024-01-01 · Category: installation

Complete guide to Ansible modules. What are modules, how to use them, and a categorized reference of the most important built-in modules (ansible.builtin) with YAML examples.

Ansible Modules: Complete List & Guide to Built-in Modules (2026)

Ansible modules are the building blocks of automation. Each module performs a specific task — installing packages, copying files, managing services, or configuring cloud resources. This guide covers what modules are, how to use them, and the most important built-in modules organized by category.

What Are Ansible Modules?

Modules are units of code that Ansible executes on remote hosts. Each module: • Performs a single, specific task (install package, create user, copy file) • Is idempotent — running it multiple times produces the same result • Returns JSON with status, changes, and output • Can be used in playbooks or ad-hoc commands

Using Modules

In Playbooks

In Ad-Hoc Commands

FQCN vs Short Names

File Management Modules

| Module | Purpose | |--------|---------| | ansible.builtin.copy | Copy files from local to remote | | ansible.builtin.template | Deploy Jinja2 templates | | ansible.builtin.file | Manage file properties (permissions, symlinks) | | ansible.builtin.lineinfile | Add/replace lines in files | | ansible.builtin.blockinfile | Insert/update text blocks in files | | ansible.builtin.fetch | Copy files from remote to local | | ansible.builtin.stat | Get file status information | | ansible.builtin.find | Find files matching criteria | | ansible.builtin.unarchive | Extract archives on remote hosts | | ansible.builtin.get_url | Download files from URLs | | ansible.posix.synchronize | Rsync files between hosts |

Package Management Modules

| Module | Target | |--------|--------| | ansible.builtin.apt | Debian/Ubuntu | | ansible.builtin.yum | RHEL/CentOS 7 | | ansible.builtin.dnf | RHEL/CentOS 8+/Fedora | | ansible.builtin.pip | Python packages | | ansible.builtin.package | OS-agnostic (auto-detects) | | community.general.snap | Snap packages | | community.general.flatpak | Flatpak packages | | community.general.homebrew | macOS Homebrew |

Service Management Modules

| Module | Purpose | |--------|---------| | ansible.builtin.systemd | Manage systemd services | | ansible.builtin.service | Generic service management | | ansible.builtin.service_facts | Gather service status |

Command Execution Modules

| Module | Use Case | |--------|----------| | ansible.builtin.command | Run commands (no shell features) | | ansible.builtin.shell | Run commands with pipes/redirects | | ansible.builtin.raw | Run commands without Python | | ansible.builtin.script | Run local script on remote | | ansible.builtin.expect | Interactive command automation |

User and Group Modules

| Module | Purpose | |--------|---------| | ansible.builtin.user | Manage user accounts | | ansible.builtin.group | Manage groups | | ansible.posix.authorized_key | Manage SSH authorized keys |

Networking and Cloud Modules

| Collection | Platform | |-----------|----------| | amazon.aws | AWS (EC2, S3, RDS, etc.) | | azure.azcollection | Microsoft Azure | | google.cloud | Google Cloud Platform | | community.vmware | VMware vSphere | | community.docker | Docker containers | | kubernetes.core | Kubernetes | | ansible.netcommon | Network devices |

System Modules

| Module | Purpose | |--------|---------| | ansible.builtin.cron | Manage cron jobs | | ansible.builtin.hostname | Set hostname | | ansible.builtin.sysctl | Manage kernel parameters | | ansible.posix.mount | Manage filesystem mounts | | ansible.builtin.reboot | Reboot and wait | | ansible.builtin.wait_for | Wait for conditions | | ansible.builtin.setup | Gather system facts |

Variable and Logic Modules

| Module | Purpose | |--------|---------| | ansible.builtin.debug | Print variables and messages | | ansible.builtin.set_fact | Set runtime variables | | ansible.builtin.assert | Validate conditions | | ansible.builtin.fail | Fail with custom message | | ansible.builtin.pause | Pause execution | | ansible.builtin.include_vars | Load variables from file | | ansible.builtin.wait_for | Wait for conditions |

Task Flow Modules

| Module | Purpose | |--------|---------| | ansible.builtin.include_tasks | Dynamically include tasks | | ansible.builtin.import_tasks | Statically import tasks | | ansible.builtin.include_role | Dynamically include role | | ansible.builtin.import_role | Statically import role | | ansible.builtin.block | Group tasks with error handling |

Finding and Installing Modules

Search for Modules

Install Module Collections

FAQ

What are the most used Ansible modules?

The most commonly used modules are: copy, template, file, apt/dnf, systemd/service, command/shell, user, debug, lineinfile, and get_url. These cover file management, package installation, service control, and system administration.

How many modules does Ansible have?

Ansible ships with thousands of modules across collections. The ansible.builtin collection includes ~70 core modules. The full Ansible package (with community.general etc.) provides 5,000+ modules covering cloud, network, security, and application platforms.

What is the difference between a module and a plugin in Ansible?

Modules execute tasks on remote hosts (install package, copy file). Plugins extend Ansible's core functionality on the control node — connection plugins, lookup plugins, filter plugins, callback plugins. Modules do the work; plugins modify how Ansible operates.

Should I use FQCN for module names?

Yes. Using Fully Qualified Collection Names (ansible.builtin.copy instead of copy) is recommended. It's explicit, avoids name conflicts between collections, and is required for modules outside ansible.builtin.

Conclusion

Ansible modules are the foundation of infrastructure automation. Start with the built-in modules for file management, packages, and services, then expand with collection modules for cloud, containers, and networking. Use ansible-doc to explore available modules and their parameters.

Related ArticlesGetting Started with AnsibleAnsible Playbook: Complete GuideAnsible Galaxy: Install Collections & RolesAnsible Custom Modules: Write Your Own

Category: installation

Browse all Ansible tutorials · AnsiblePilot Home