Operations 8 min read

Master Ansible: Architecture, Workflow, and the Seven Essential Commands

This article introduces Ansible as an open‑source automation tool, explains its core architecture and workflow, and provides detailed usage of its seven primary commands with examples, helping readers quickly grasp how to configure, deploy, and manage systems efficiently.

Efficient Ops
Efficient Ops
Efficient Ops
Master Ansible: Architecture, Workflow, and the Seven Essential Commands

Ansible is an open‑source automation tool that uses YAML playbooks to automate server configuration, deployment, and management.

It communicates via SSH, requires no client software on target machines, and supports Linux, Windows, macOS, and more, enabling tasks such as software installation, service configuration, data backup, and application deployment.

1. Ansible Core Architecture

The architecture consists of:

Core: Ansible

Core Modules: built‑in modules

Custom Modules: user‑added extensions

Plugins: extend module functionality

Playbooks: task configuration files executed by Ansible

Connection Plugins: manage connections (SSH by default, plus others)

Host Inventory: defines managed hosts

2. Ansible Working Principle

The management node can connect to targets via local, SSH, or ZeroMQ (default SSH). Hosts are grouped in the inventory, allowing ad‑hoc commands or batch operations. Playbooks combine multiple tasks to perform complex functions such as web service deployment or database backup.

3. The Seven Ansible Commands

After installing Ansible, seven main commands are available: ansible , ansible-doc , ansible-galaxy , ansible-lint , ansible-playbook , ansible-pull , and ansible-vault . Below are usage examples.

3.1 ansible

[root@localhost ~]# ansible -h
Usage: ansible [options]

Executes ad‑hoc commands. Example:

[[email protected] ~]# ansible 192.168.0.102 -a 'date'
192.168.0.102 | success | rc=0 >>
Tue May 12 22:57:24 CST 2015

Parameters can be customized in ansible.cfg.

3.2 ansible-doc

ansible-doc -h
Usage: ansible-doc [options] [module...]

Shows module information. List all modules: # ansible-doc -l Show details for a specific module (e.g., command):

# ansible-doc -s command

3.3 ansible-galaxy

ansible-galaxy -h
Usage: ansible-galaxy [init|info|install|list|remove] [--help] [options] ...

Downloads third‑party roles from Ansible Galaxy . Example:

[root@localhost ~]# ansible-galaxy install aeriscloud.docker
- downloading role 'docker', owned by aeriscloud
- downloading role from https://github.com/AerisCloud/ansible-docker/archive/v1.0.0.tar.gz
- extracting aeriscloud.docker to /etc/ansible/roles/aeriscloud.docker
- aeriscloud.docker was installed successfully

3.4 ansible-lint

Checks playbook syntax: ansible-lint playbook.yml.

3.5 ansible-playbook

Runs playbooks, the most frequently used command.

3.6 ansible-pull

Executes the pull mode, opposite of the default push mode, suitable for large fleets or offline machines.

3.7 ansible-vault

Encrypts/decrypts sensitive data in configuration files. Use with --ask-vault-pass to run playbooks containing encrypted variables.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

automationOperationsConfiguration ManagementDevOpsAnsible
Efficient Ops
Written by

Efficient Ops

This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.