Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Use ansible.builtin.package when the same task must work across Linux distributions, and switch to ansible.builtin.apt or ansible.builtin.dnf when you need manager-specific controls. Set an explicit desired state such as present, absent, or (where supported) latest; run changing tasks with privilege escalation; and verify results with ansible.builtin.package_facts instead of parsing command output.

The examples below use fully qualified collection names (FQCNs), account for distribution-specific package names, and show the prerequisites that commonly make an otherwise-correct playbook fail.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the module that matches the job

Ansible has two different package-management concerns: changing the target system and reading its current package state. The generic package module handles common install and removal operations without naming a manager. The apt and dnf modules expose controls that are meaningful only on their respective families. The package-facts module is for inspection, not installation.

Requirement Recommended module What it provides Important limitation
One task for several Linux families ansible.builtin.package Uses the package manager discovered from gathered facts; accepts one name or a list; supports present and absent, and latest when the underlying manager supports it. It cannot expose every apt or dnf option, and a package may have a different name on another distribution.
Debian or Ubuntu controls ansible.builtin.apt Cache refresh and age control, versions, local or remote .deb files, upgrades, autoremove, autoclean, and purge-related operations. The managed host needs the python3-apt bindings.
Fedora, RHEL and other DNF-family controls ansible.builtin.dnf Install, upgrade, remove and list packages or groups, with repository selection, version constraints, lock timeouts and cache behavior. The managed host needs python3-dnf.
Determine whether a package is installed ansible.builtin.package_facts Returns installed-package data under ansible_facts.packages; can use an automatic, apt, rpm/dnf, apk, pacman, pkg, pkg_info or portage manager. It reports state; it does not make a package present or absent.

Prerequisites and a safe execution pattern

Run changes with the required privilege

Package databases and system files normally require root access. Put become: true at play or task scope for installs, removals and upgrades. If your inventory uses a non-root account, configure a working privilege-escalation method and test it before running a large fleet.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.
- name: Manage packages on Linux hosts
  hosts: linux
  become: true
  tasks:
    - name: Install a baseline tool
      ansible.builtin.package:
        name: curl
        state: present

Install the manager bindings on the managed host

The module runs on the target, not on the controller. The target therefore needs a usable Python interpreter and the binding required by its manager. The apt module specifies python3-apt; dnf specifies python3-dnf; package facts likewise needs the relevant apt or RPM support. Minimal images may omit both Python and these bindings. Build them into the image or use an environment-specific bootstrap task before invoking the normal package role; there is no single bootstrap sequence that works for every image.

Gather facts when automatic selection or naming depends on them

The generic package module chooses a manager from gathered facts. If a play disables fact gathering, gather the facts before package tasks or use a manager-specific module explicitly. Facts also let you select the correct package name for each operating-system family.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install packages portably with ansible.builtin.package

The portable module is the best default when all you need is a convergent state. A task with state: present installs a package only when it is missing; rerunning the play leaves an already-installed package unchanged. Use a list to keep a baseline in one reviewable place.

- name: Install common packages
  hosts: all
  become: true
  tasks:
    - name: Ensure monitoring tools are installed
      ansible.builtin.package:
        name:
          - curl
          - vim
        state: present

Remove packages

Set state: absent when the desired outcome is that the package is not installed. The task is idempotent: once the package is gone, later runs do not remove anything else merely because the task is repeated.

- name: Remove an obsolete utility
  hosts: all
  become: true
  tasks:
    - name: Ensure the legacy tool is absent
      ansible.builtin.package:
        name: legacy-tool
        state: absent

Use latest only when the manager supports it

state: latest asks the selected backend to bring a package to its newest available version. Support depends on the underlying manager, so do not assume identical behavior on every platform. If reproducibility matters, pin a version with a manager-specific module instead of allowing a moving target.

Force a manager only for a real discovery problem

The generic module has a use option that can force a manager such as dnf when automatic detection is inappropriate. Prefer normal fact-based detection first; forcing a backend that is not installed or does not own the target package produces a failure rather than portability.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Handle distribution-specific names with variables

Package names are not standardized. A web server, compiler or mail utility can have one name on Debian-family systems and another on Red Hat-family systems. Keep the difference visible in variables instead of scattering conditional strings through tasks.

- name: Install a web server using the platform name
  hosts: web
  become: true
  vars:
    web_package_by_family:
      Debian: nginx
      RedHat: nginx
    web_package: "{{ web_package_by_family[ansible_facts.os_family] }}"
  tasks:
    - name: Ensure the web server package is present
      ansible.builtin.package:
        name: "{{ web_package }}"
        state: present

If a family has no matching key, the variable lookup fails before a misleading package-manager error. Add an explicit supported-family check or provide a deliberate default rather than guessing a name.

Use ansible.builtin.apt on Debian and Ubuntu

Install and refresh the cache safely

The apt module manages Debian-family packages and can refresh repository metadata. cache_valid_time limits how often a refresh occurs; the value is in seconds. This example refreshes only when the cache is older than one hour.

- name: Install nginx on Debian-family hosts
  hosts: debian
  become: true
  tasks:
    - name: Ensure nginx is installed
      ansible.builtin.apt:
        name: nginx
        state: present
        update_cache: true
        cache_valid_time: 3600

Refreshing the cache on every task adds needless repository traffic. Put cache behavior on the tasks that need current metadata, and keep the package list explicit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install a specific version

Apt accepts package versions, allowing a playbook to express a fixed target instead of whatever version happens to be newest at execution time.

- name: Install an approved nginx version
  become: true
  ansible.builtin.apt:
    name: nginx=1.24.0-2
    state: present
    update_cache: true

Version strings are repository- and distribution-specific. Confirm that the requested version exists in the repositories configured on every target before enforcing it.

Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Remove, purge and clean up

Use apt’s removal and cleanup options when Debian-family semantics matter. A normal removal leaves configuration files according to apt behavior; purge-related operations remove package configuration. The module also supports autoremove and autoclean. Treat autoremove as a deliberate policy because it can remove dependencies that are no longer marked as required.

- name: Remove nginx and purge its package configuration
  become: true
  ansible.builtin.apt:
    name: nginx
    state: absent
    purge: true

- name: Remove no-longer-needed dependencies
  become: true
  ansible.builtin.apt:
    autoremove: true

Install local or remote Debian packages

The apt module can install a local or remote .deb file. Make the file source and trust boundary explicit, and ensure dependencies are available from configured repositories. A file-based install is not interchangeable with a normal repository package: upgrades and version availability depend on how that file is maintained.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not use force as a repair shortcut

Apt’s force option disables signature and certificate checks and can damage the system. It should almost never be used. Fix repository configuration, keys, certificates or package metadata instead of bypassing verification.

Use ansible.builtin.dnf on DNF-family systems

Install and remove packages

- name: Install nginx on DNF-family hosts
  hosts: dnf_hosts
  become: true
  tasks:
    - name: Ensure nginx is installed
      ansible.builtin.dnf:
        name: nginx
        state: present

    - name: Remove an obsolete package
      ansible.builtin.dnf:
        name: old-agent
        state: absent

DNF also supports state: latest when you intentionally want the newest repository version. Keep the state explicit so a repeated run converges on the same policy rather than relying on a module default.

Use DNF-specific controls when the generic module is not enough

Choose the DNF module when you need repository selection, package groups, version constraints, lock timeouts or cache behavior. Those controls are the reason to leave the portable abstraction.

- name: Install a development group from a selected repository
  become: true
  ansible.builtin.dnf:
    name: '@Development Tools'
    state: present
    enablerepo: build-repo
    lock_timeout: 60

Repository identifiers and group names are distribution-specific. Validate them on the target family before rolling out the task.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Understand the yum name on current Ansible

Current documentation describes ansible.builtin.yum as an alias or redirect to the DNF implementation. The old YUM backend was removed from ansible-core 2.17. Use the FQCN ansible.builtin.dnf in new playbooks so the intended backend is clear and future maintenance does not depend on an alias.

Make package changes idempotent

Express the desired state, not a shell command

Package modules check current state and report whether a change is needed. A shell command such as a raw apt install or dnf install line does not provide that same state model and usually causes noisy, non-idempotent runs. Use a module unless the operation truly cannot be represented by it.

Keep package lists in variables

A variable makes the fleet’s baseline auditable and simplifies overrides for a host group or environment.

- name: Install the platform baseline
  hosts: all
  become: true
  vars:
    baseline_packages:
      - curl
      - ca-certificates
      - vim
  tasks:
    - name: Converge the baseline package set
      ansible.builtin.package:
        name: "{{ baseline_packages }}"
        state: present

Separate installation policy from upgrade policy

present answers whether a package exists; latest answers whether it should track the newest available version. These are different operational decisions. Use present for a stable baseline, and schedule or review latest tasks when automatic upgrades are acceptable. For strict releases, use an explicit version with apt or dnf and update that value intentionally.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not confuse absence with purge

The generic module’s absent state removes a package according to the backend. If you need Debian-specific purging, use the apt module and its purge-related options. The distinction matters when configuration files must be retained for a later reinstall or removed for decommissioning.

Inspect installed packages with ansible.builtin.package_facts

Use package facts when a later task needs to branch on installation state or report a version. It returns data under ansible_facts.packages, where each package name maps to one or more installed-version records.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
- name: Gather installed package facts
  hosts: all
  become: true
  tasks:
    - name: Read package state from the available manager
      ansible.builtin.package_facts:
        manager: auto

    - name: Report the installed curl version
      ansible.builtin.debug:
        var: ansible_facts.packages.curl
      when: "'curl' in ansible_facts.packages"

Select the manager and strategy deliberately

manager: auto chooses from supported backends. You can request a specific manager such as apt, rpm or dnf, apk, pacman, pkg, pkg_info or portage. The strategy can return the first available manager or all available managers. Use the all-managers strategy only when you have a reason to inspect more than one package database.

- name: Gather facts from the RPM database
  become: true
  ansible.builtin.package_facts:
    manager:
      - rpm
    strategy: first

Check presence without failing on an absent key

An uninstalled package may not appear in the facts dictionary. Test membership before reading its version, as in the curl example. This avoids an undefined-variable failure and lets you provide a useful branch.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
- name: Explain that the agent is missing
  ansible.builtin.debug:
    msg: monitoring-agent is not installed
  when: "'monitoring-agent' not in ansible_facts.packages"
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify a change in the same play

A package task’s changed status tells you whether Ansible made a change, while package facts let you inspect the resulting state. Gather facts after the change when verification is required.

- name: Ensure and verify curl
  hosts: all
  become: true
  tasks:
    - name: Install curl
      ansible.builtin.package:
        name: curl
        state: present

    - name: Refresh installed-package facts
      ansible.builtin.package_facts:
        manager: auto

    - name: Fail if curl is still absent
      ansible.builtin.fail:
        msg: curl was requested but is not present in package facts
      when: "'curl' not in ansible_facts.packages"

Facts gathered before an install describe the earlier state. If you need post-change evidence, place the package-facts task after the package task.

Combine portable and specific tasks by operating system

A play can remain portable while giving each family the controls it needs. Use the generic module for common packages, then branch to apt or dnf for cache policy, versions, groups or cleanup.

- name: Configure a mixed Linux fleet
  hosts: all
  become: true
  tasks:
    - name: Install the common command-line tools
      ansible.builtin.package:
        name:
          - curl
          - vim
        state: present

    - name: Install nginx with apt cache policy
      ansible.builtin.apt:
        name: nginx
        state: present
        update_cache: true
        cache_valid_time: 3600
      when: ansible_facts.os_family == 'Debian'

    - name: Install nginx with DNF
      ansible.builtin.dnf:
        name: nginx
        state: present
      when: ansible_facts.os_family == 'RedHat'

Use conditions based on gathered facts, not guesses from host names. If a distribution family is unsupported, fail clearly or exclude it from the play rather than silently applying the wrong manager.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot the common failure modes

Symptom Likely cause Corrective action
The module cannot import a package-manager library. The target lacks python3-apt, python3-dnf, RPM support, or a Python interpreter. Install the binding in the image or run an image-specific bootstrap step before normal package tasks; verify the interpreter used by Ansible.
Permission denied while updating the package database. The task is running as an unprivileged account. Add become: true and confirm that privilege escalation is configured for the inventory user.
A package name cannot be found. The name differs by distribution, the repository is unavailable, or metadata is stale. Select the name from OS-family variables, refresh apt metadata where appropriate, and verify repository configuration.
A generic package task chooses the wrong backend. Facts were not gathered or automatic detection is unsuitable for the host. Gather facts before the task, use a manager-specific module, or set the generic module’s use option to an installed backend.
latest behaves differently across hosts. The underlying managers expose different upgrade capabilities or repositories contain different versions. Use present for existence, or pin an explicit version with apt or dnf when uniformity matters.
Verification reports an old state after installation. Package facts were gathered before the change. Run package_facts again after the package task.
An apt task bypasses repository verification. force: true was used as a workaround. Remove force; repair signatures, certificates or repository metadata instead.

A practical decision framework

  1. Need only install or remove a package across families? Start with ansible.builtin.package, explicit name and state.
  2. Do names differ? Define a variable by ansible_facts.os_family and fail clearly for unsupported families.
  3. Need cache age, purge, a local .deb, autoremove or apt version syntax? Use ansible.builtin.apt on Debian-family hosts.
  4. Need groups, repository selection, lock timeouts or DNF version controls? Use ansible.builtin.dnf on DNF-family hosts.
  5. Need to inspect state or branch on an installed version? Gather ansible.builtin.package_facts and test membership before reading a package record.
  6. Will the task change the system? Add become: true, and verify that the manager binding and Python interpreter exist on every target.

Reference playbook pattern

This pattern keeps the common baseline portable, gives Debian and DNF hosts their own manager-specific task, and verifies the result.

- name: Install and verify a Linux package baseline
  hosts: all
  become: true
  gather_facts: true
  vars:
    baseline_packages:
      - curl
      - vim
    web_package_by_family:
      Debian: nginx
      RedHat: nginx
  tasks:
    - name: Install portable baseline packages
      ansible.builtin.package:
        name: "{{ baseline_packages }}"
        state: present

    - name: Install the family-specific web package
      ansible.builtin.package:
        name: "{{ web_package_by_family[ansible_facts.os_family] }}"
        state: present

    - name: Refresh apt metadata when needed
      ansible.builtin.apt:
        update_cache: true
        cache_valid_time: 3600
      when: ansible_facts.os_family == 'Debian'

    - name: Gather installed package facts
      ansible.builtin.package_facts:
        manager: auto

    - name: Show the installed curl record
      ansible.builtin.debug:
        var: ansible_facts.packages.curl
      when: "'curl' in ansible_facts.packages"

In production, validate the family-to-name mapping for every supported distribution, keep version pins in reviewable variables, and test the play against a representative minimal image as well as a full installation.

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.