device-setup/doc/apt.md

1.5 KiB

The apt module in Ansible is used to manage packages on Ubuntu and other Debian-based systems. When using this module, the package can have different states depending on what you want to achieve. Here are the possible states of the apt module:

present: This state ensures that the package is installed on the system. If the package is not already installed, it will be installed. If the package is already installed, this state does nothing.

latest: This state ensures that the package is installed on the system and that it is the latest version available in the configured repositories. If the package is not already installed, it will be installed. If the package is already installed and an update is available, the package will be updated to the latest version.

absent: This state ensures that the package is not installed on the system. If the package is already installed, it will be removed.

held: This state ensures that the package is held at its current version and is not upgraded automatically. This is useful when you want to prevent a package from being automatically upgraded, for example, because the new version is not compatible with your system.

purged: This state ensures that the package and its configuration files are removed from the system. This is useful when you want to completely remove a package and its configuration files from the system.

You can specify the desired state of the package in the Ansible playbook or task, depending on what you want to achieve.