Quick answer: Ansible is an open-source configuration automation / Infrastructure as Code tool (backed by Red Hat) that needs no agent: it only requires SSH access to the target machines and Python. Its main parts are the inventory (list of machines), playbooks (YAML files describing what to do), modules (apt, copy, service and more) and roles (reusable bundles of playbooks). To get started: (1) install it on the control machine with pip install ansible or apt install ansible; (2) set up SSH keys to the target machines; (3) create an inventory; (4) write a playbook; (5) run ansible-playbook -i inventory site.yml. Benefits: consistent, repeatable changes with fewer manual errors, ideal for installing software, configuring servers and deploying applications at scale.
Introduction to Ansible and system administration automation
Ansible is a powerful configuration management tool that makes automating system administration simple and efficient. It was created by Michael DeHaan and first released in 2012, with the goal of saving IT professionals time and effort by automating repetitive administration tasks. Red Hat acquired Ansible in 2015.
Automating administration with Ansible increases consistency, saves money and reduces human error. Its relationship with Infrastructure as Code (IaC) is especially important: Ansible lets you manage infrastructure as code, which improves the way applications are developed and deployed.
Benefits of using Ansible
- Saves time and cost: automated tasks take far less time than manual work.
- Reduces human error: each step is clearly defined in a playbook, lowering the risk of mistakes.
- Consistency and scalability: configuration stays uniform across many servers and environments.
- Faster deployments and updates: application deployments and system updates run quickly and in sync.
Ansible’s main components
- Control node: the machine that runs Ansible and executes all commands.
- Managed nodes: the servers Ansible manages, where tasks are carried out.
- Inventory: the list of managed hosts, used to target tasks.
- Modules: units of work that each perform a specific task, making Ansible extensible.
- Playbooks: ordered collections of tasks that organise your automation logic.
Installing and configuring Ansible
- System requirements: the control node needs Linux or macOS (or WSL on Windows) and Python; managed nodes need SSH and Python.
- Install on the control node:
sudo apt install ansibleon Debian/Ubuntu,sudo dnf install ansible-coreon Fedora or RHEL-based systems, orpip install ansible. - Set up SSH keys to managed nodes: generate a key pair and add the public key to
~/.ssh/authorized_keyson each managed node (for example withssh-copy-id). - Test connectivity: run
ansible all -m pingto check the control node can reach every managed node.
Writing your first playbook
- Playbook structure: a playbook is a YAML file that starts with three dashes (
---) and contains elements such as hosts, tasks and vars. - Use modules for simple tasks: for example, the
filemodule creates files and directories. - Use variables to customise playbooks: define variables to adapt the same playbook to different hosts or environments.
- Use handlers for change-triggered actions: handlers run only when something has changed, such as restarting a service after its configuration is updated.
Examples of tasks you can automate
- Install and configure web servers such as Apache or Nginx.
- Deploy applications quickly and consistently.
- Update systems: patch packages and the operating system without manual intervention.
- Manage user accounts: add, modify or remove users.
- Configure firewalls in a repeatable way.
Managing playbooks effectively
- Use Git for version control: track changes and roll back easily when needed.
- Use roles to reuse code: roles organise playbooks and let you reuse them across projects.
- Use Ansible Vault for secrets: encrypt passwords and other sensitive variables.
Ansible and DevOps
- Ansible in CI/CD pipelines: integrate Ansible into CI/CD to automate testing environments and deployments.
- Automating repetitive DevOps work: tasks such as environment setup and releases run quickly, saving the team time.
Tips and tricks
- Use
ansible-lintto catch mistakes and style problems in playbooks. - Use
ansible-galaxyto find and reuse community roles and collections. - Follow best practices: keep tasks idempotent, name every task, and test changes with
--checkbefore applying them.
Conclusion and next steps
Ansible stands out for automating system administration, saving time and improving efficiency in modern IT environments. To go further, read the official documentation and consider advanced Ansible courses.
Need help automating your company’s server and network administration? Contact IT Systems at hotline 028.3995.03.59 or contact@itsystems.com.vn.
Need someone to run your servers, NAS and systems?
IT Systems manages servers, NAS, cloud, backup and user accounts on a schedule, with a monthly operations report.


