Free tools Windows power users keep installed
One-click scans. No signup required.
Ansible manages Linux servers from a control node by matching an inventory pattern to hosts, connecting over SSH, and applying modules that describe the desired state. Use ansible for a rare one-off operation; use ansible-playbook for repeatable, reviewable automation. The workflow below takes you from inventory and connectivity checks through packages, services, files, users, privilege escalation, Vault, testing, and troubleshooting.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
What you need before running Ansible
Ansible does not discover arbitrary servers by itself. Every target must be represented in an inventory, and the control node must be able to authenticate to each host. Most Linux deployments use SSH, although other connection methods are available in specific environments.
As an Amazon Associate I earn from qualifying purchases.
Recommended Free Tools
- Ansible installed on a control node (a workstation, jump host, CI runner, or management server).
- An inventory containing hostnames or IP addresses arranged into useful groups such as
web,db, andall. - DNS or network reachability from the control node to each target.
- An approved SSH key or other credential, the correct remote username, and an acceptable host-key policy.
- Privilege escalation configured for tasks that require root access.
Installation commands differ by operating system and by the Ansible release you select. Install with the distribution method appropriate to your control node, then check the installed version before adopting examples. Ansible documentation is versioned, and both ansible-core and collections evolve.
ansible --version
Record the ansible-core and collection versions used by production automation. A command copied from documentation for another release can have different parameters or module behavior.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Build and inspect an inventory
An inventory is the map Ansible uses to resolve host patterns. A small INI inventory is sufficient for a first run:
[web]
web1.example.com
web2.example.com
[db]
db1.example.com
[all:vars]
ansible_user=ops
You can use IP addresses instead of names, and inventory variables can define a non-default SSH port, interpreter, or connection options. Keep credentials out of the inventory; use approved SSH configuration, an external secret system, or Ansible Vault.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsCheck the groups Ansible sees
ansible-inventory -i inventory --graph
The graph should show the expected all, web, and db membership. If a host is missing, fix the inventory before investigating task logic. Host patterns can then target one host, a group, or a compound selection such as web:!web2.example.com.
Test SSH and Ansible connectivity
ansible all -i inventory -m ansible.builtin.ping
A successful result contains pong for each reachable host. The ping module tests Ansible’s connection and remote Python execution; it is not an ICMP network ping. If it fails, verify DNS, routing, the remote user, the selected key, SSH permissions, and host-key policy before changing a playbook.
Ad hoc commands versus playbooks
When to use ansible
The canonical ad hoc form is:
ansible [pattern] -m [module] -a "[module options]"
Ad hoc commands are useful for tasks you repeat rarely: checking connectivity, querying facts, rebooting a group, copying a known file, or installing one package during an incident. They are fast and still use Ansible modules, but the command itself is not a durable record of the desired configuration.
When to use ansible-playbook
A playbook is a YAML automation blueprint. Use one when work must be repeated, reviewed, shared, tested in check mode, or applied consistently across many hosts. Playbooks can order tasks, notify handlers, loop over data, branch with conditions, delegate work to another host, run asynchronously, and organize reusable roles and collections.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
| Need | Best choice | Reason |
|---|---|---|
| One rare operation | ansible ad hoc command |
Minimal setup and immediate output. |
| Repeatable server state | ansible-playbook |
YAML can be reviewed, versioned, tested, and reused. |
| Many related tasks with dependencies | Playbook, usually organized into a role | Variables, handlers, tags, and task ordering remain explicit. |
| Third-party or platform-specific content | Fully qualified collection modules | Collection ownership and version assumptions are clear. |
High-value Linux ad hoc commands
Use fully qualified built-in module names in new automation. The examples below assume the inventory file is named inventory.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Install or remove packages
ansible web -i inventory -m ansible.builtin.package -a "name=nginx state=present" --become
ansible web -i inventory -m ansible.builtin.package -a "name=nginx state=absent" --become
ansible.builtin.package uses the target platform’s package manager. It expresses the requested state instead of hard-coding one distribution’s command. Parameters can vary by platform and Ansible version, so check the module documentation for the installed release.
Manage services
ansible web -i inventory -m ansible.builtin.service -a "name=nginx state=started enabled=true" --become
ansible web -i inventory -m ansible.builtin.service -a "name=nginx state=restarted" --become
The generic service module can start, stop, restart, and enable services. Where a platform-specific service module is available, verify its current parameters and use it when it gives more precise control.
Copy a known file
ansible web -i inventory -m ansible.builtin.copy -a "src=files/nginx.conf dest=/etc/nginx/nginx.conf owner=root group=root mode=0644" --become
copy transfers a controller-side file and can set ownership and permissions. It is appropriate when the file contents are already complete and do not need variable substitution.
Create directories and manage file state
ansible all -i inventory -m ansible.builtin.file -a "path=/srv/app state=directory owner=app group=app mode=0750" --become
ansible all -i inventory -m ansible.builtin.file -a "path=/srv/app/old.conf state=absent" --become
The file module manages directories, links, permissions, and whether a path exists. It is preferable to mkdir, chmod, or rm shell commands because it can determine whether a change is needed.
Create or modify users
ansible all -i inventory -m ansible.builtin.user -a "name=deploy group=deploy shell=/bin/bash create_home=true" --become
The user module manages accounts and group membership. Password hashes and private credentials should not be placed directly in a command line or committed to source control.
Reboot a host deliberately
ansible web -i inventory -m ansible.builtin.reboot --become
Use the reboot module rather than a raw reboot command when you need Ansible to wait for the host to go down and return. Limit the pattern carefully; a reboot against all can interrupt every managed system.
Use command and shell only as escape hatches
ansible all -i inventory -m ansible.builtin.command -a "uname -r"
ansible all -i inventory -m ansible.builtin.shell -a "systemctl is-active nginx"
command runs a program without shell parsing. shell enables pipes, redirects, expansion, and other shell syntax. Both are less expressive and often less idempotent than purpose-built modules. Quote carefully, never embed secrets, and add a condition or a state-aware module when a repeated run must avoid unnecessary changes.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchRank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Write a repeatable playbook
A minimal web-server playbook can install a package, deploy a configuration, and restart the service only when that configuration changes:
---
- name: Configure web servers
hosts: web
become: true
tasks:
- name: Install nginx
ansible.builtin.package:
name: nginx
state: present
- name: Deploy nginx configuration
ansible.builtin.template:
src: templates/nginx.conf.j2
dest: /etc/nginx/nginx.conf
owner: root
group: root
mode: '0644'
notify: Restart nginx
- name: Ensure nginx is enabled and running
ansible.builtin.service:
name: nginx
state: started
enabled: true
handlers:
- name: Restart nginx
ansible.builtin.service:
name: nginx
state: restarted
Save this as site.yml. A handler runs after notified tasks, normally at the end of the play, so a service restart occurs only when the template task reports a change. Test handler behavior in a disposable environment before using it on production systems.
Validate before changing anything
- Check YAML and task structure:
ansible-playbook -i inventory site.yml --syntax-check - Preview supported changes and configuration differences:
ansible-playbook -i inventory site.yml --check --diff - Restrict the first real run to one host or a narrow group with
--limit. - Run the complete play only after the limited execution gives the expected result.
ansible-playbook -i inventory site.yml
ansible-playbook -i inventory site.yml --limit web1.example.com
Check mode cannot predict every change: modules that call external systems or execute arbitrary commands may not support a complete dry run. Treat the preview as a safety aid, not proof that no side effect can occur.
Modules for common Linux management jobs
| Module | Use it for | Why it is safer than a raw command |
|---|---|---|
ansible.builtin.package |
Install, update, or remove packages. | Delegates to the platform package manager and checks requested state. |
ansible.builtin.service |
Start, stop, restart, and enable services. | Models service state and avoids needless actions. |
ansible.builtin.copy |
Place a known controller-side file. | Can compare content and enforce owner, group, and mode. |
ansible.builtin.template |
Render a Jinja2 configuration from variables. | Produces deterministic files and reports changes. |
ansible.builtin.file |
Create paths, links, directories, permissions, or absence. | Expresses file state directly. |
ansible.builtin.user |
Create accounts and manage groups and shells. | Handles account state instead of editing system files manually. |
ansible.builtin.command |
Run a program when no suitable module exists. | Avoids shell interpretation, but still needs idempotence planning. |
ansible.builtin.shell |
Use shell syntax unavailable to command. |
Flexible but exposes quoting, injection, and repeat-run risks. |
State-aware modules can return ok when the target already matches the request and changed when they alter it. A task that reports changed on every run usually needs a different module, a guard such as creates or removes, or a condition based on gathered facts.
Privilege escalation with become
Tasks such as package installation, writing under /etc, account management, and service control generally require elevated privileges. Set escalation at play scope when most tasks need it:
- hosts: web
become: true
tasks:
- name: Install a package
ansible.builtin.package:
name: nginx
state: present
For a one-off ad hoc operation, use --become. If the elevated identity is not root, set the intended account explicitly with become_user in the play or task. Confirm that the remote user is allowed to escalate and that any sudo policy, password prompt, or alternate become method is configured on the control node.
Do not enable escalation merely because it is convenient. Keep read-only discovery tasks unprivileged where possible, and scope become to the smallest set of tasks that need it.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Protect credentials with Ansible Vault
Passwords, private keys, API tokens, and become passwords do not belong in an inventory file or Git history. Ansible Vault encrypts YAML variables and other files so encrypted content can be stored with the playbook while the decryption secret is supplied at run time.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Use the Vault commands and password-handling method documented for your installed Ansible version. Typical workflows include creating or editing an encrypted variables file, then supplying a vault password prompt or an approved password client when running a playbook. Keep the vault password itself outside the repository, restrict its permissions, and avoid printing secret variables in task output or debug messages.
Vault protects data at rest; it does not automatically prevent a secret from appearing in logs after a module receives it. Mark tasks that handle sensitive values with no_log: true when appropriate, while recognizing that this also hides useful failure details.
Make playbooks safe to repeat
Idempotence means converging a host to the requested state without making an unnecessary change on every run. Build it into each task:
- Use package, service, file, template, and user modules instead of imperative shell commands.
- Specify a clear state such as
present,absent,started, ordirectory. - Use handlers for restarts triggered by actual configuration changes.
- Guard unavoidable commands with conditions, registered results, or
creates/removeschecks. - Keep templates deterministic; avoid embedding timestamps or random values unless a change on every run is intentional.
Use loops for repeated data rather than duplicating nearly identical tasks. Use conditionals to select platform-specific behavior, and use tags to run a focused subset during maintenance. Tags and --start-at-task can bypass assumptions made by earlier tasks, so understand dependencies before using them on a partial run.
Playbook features that scale beyond one server
Loops and conditionals
Loops let one task manage a list of packages, directories, or accounts. Conditionals can branch on variables or gathered facts, such as selecting a service name that differs by distribution. Keep the data separate from the task logic so reviews show what changes without hiding it in shell text.
Delegation
delegate_to runs a task on another host, commonly the control node or a load-balancer host. This is useful for changing traffic membership before updating an application server, but remember that variables and facts can belong to the delegated host. Make the delegation explicit and test it with a narrow limit.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Roles and collections
Roles package tasks, handlers, templates, files, defaults, and variables into a reusable structure. Collections group modules, plugins, and roles under a fully qualified collection name. Pin the ansible-core and collection versions used in production, and use the module page for those exact versions before relying on a parameter.
Includes and imports
Use includes or imports to split a large playbook into logically owned files. Static imports are expanded when the playbook is parsed; dynamic includes are selected while the play runs. Choose deliberately when conditions, tags, or task discovery depend on run-time values.
Asynchronous work
Long-running operations can be launched asynchronously and polled later, allowing independent work to proceed. Set a realistic timeout and polling strategy, and verify what happens if the control connection disappears. Asynchronous execution is not a substitute for making the underlying operation safe to retry.
Read Ansible results and troubleshoot failures
Each host’s recap and task output distinguishes several important states:
- ok: the requested state already matched.
- changed: Ansible made a modification.
- skipped: a condition, tag, or platform check excluded the task.
- failed: the module ran but returned an error.
- unreachable: Ansible could not establish or maintain the connection.
When a host is unreachable
- Resolve the inventory name and verify DNS or the configured IP.
- Check routing and firewall rules from the control node.
- Test SSH with the same username, key, port, and host-key policy Ansible uses.
- Confirm the remote account can start the required interpreter.
- Only after connectivity works, investigate
becomepermissions or playbook logic.
When a task fails after connecting
Read the module’s returned message, inspect the effective variables, and rerun against one host with increased verbosity only as much as needed. Check file ownership and modes, package-manager locks, service logs, and whether a distribution-specific parameter was used with the wrong version. Avoid “fixing” a failed task by replacing a state-aware module with an unguarded shell command.
When every run reports changed
Identify the task that changes, compare its inputs and output, and look for unstable template data, a command with no state guard, or a module parameter that is not supported by the target platform. Replace the command with a purpose-built module where possible; otherwise add a condition that accurately describes when the operation is required.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →A practical first-run sequence
Use this order for a new Linux inventory, adapting paths and options to your environment:
- Install Ansible on the control node using the method appropriate to its operating system.
- Confirm the installed release:
ansible --version - Inspect inventory groups:
ansible-inventory -i inventory --graph - Test every target’s Ansible connectivity:
ansible all -i inventory -m ansible.builtin.ping - Perform a narrowly scoped package action if required:
ansible web -i inventory -m ansible.builtin.package -a "name=nginx state=present" --become - Preview a playbook with syntax checking, check mode, and diff:
ansible-playbook -i inventory site.yml --syntax-check ansible-playbook -i inventory site.yml --check --diff - Apply it first to a limited host, then to the intended group:
ansible-playbook -i inventory site.yml --limit web1.example.com ansible-playbook -i inventory site.yml
The sequence separates inventory and authentication problems from automation problems, and it gives you a reversible checkpoint before broad execution.
Version, documentation, and enterprise considerations
Ansible releases a new major release approximately twice a year, and official documentation maintains multiple version branches. Read the documentation branch matching your installed ansible-core, verify module parameters there, and pin the versions used by production examples. Fully qualified collection names make ownership and dependency assumptions explicit.
Red Hat’s Ansible Automation Platform is an enterprise option built around the same core concepts: inventories, YAML playbooks, modules, and collections. Its documentation describes playbooks as task lists executed against inventory hosts and presents collections by fully qualified collection name. Teams evaluating an enterprise platform should still apply the same fundamentals: source-controlled playbooks, pinned content, credential separation, limited first runs, and observable change results.
Quick Recap
Quick decision checklist
- Need a one-time check or emergency action? Choose an ad hoc
ansiblecommand and target the narrowest host pattern. - Need the same result next week or on another environment? Write a playbook.
- Installing packages, managing services, files, templates, or users? Use the corresponding state-aware module.
- Writing under protected paths or changing accounts? Use scoped
become: true. - Handling credentials? Encrypt variable files with Vault, keep the vault password outside Git, and suppress secret output.
- About to affect many servers? Run syntax check, then
--check --diff, then--limiton a representative host. - Seeing unreachable hosts? Fix DNS, routing, SSH identity, host-key policy, and escalation before editing tasks.
- Seeing changes every run? Replace imperative commands with a state-aware module or add a correct idempotence guard.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




