ANSIBLE.APT(3)

NAME
apt - Manages apt-packages

DESCRIPTION

Manages apt packages (such as for Debian/Ubuntu).

OPTIONS

cache_valid_time
    If update_cache is specified and the last run is less or equal than cache_valid_time seconds ago, the update_cache gets skipped.

default_release
    Corresponds to the -t option for apt and sets pin priorities

dpkg_options
    Add dpkg options to apt command. Defaults to '-o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold"'Options should be supplied as comma separated list (default: force-confdef,force-confold)

force
    If yes, force installs/removes. Choices: yes,no. (default: no)

install_recommends
    Corresponds to the --no-install-recommends option for apt, default behavior works as apt's default behavior, no does not install recommended packages. Suggested packages are never installed. Choices: yes,no. (default: yes

pkg A package name or package specifier with version, like foo or foo=1.0. Shell like wildcards (fnmatch) like apt* are also supported.

purge
    Will force purging of configuration files if the module state is set to absent. Choices: yes,no.

state
    Indicates the desired package state Choices: latest,absent,present. (default: present)

update_cache
    Run the equivalent of apt-get update before the operation. Can be run as part of the package installation or as a separate step Choices: yes,no.

upgrade
    If yes or safe, performs an aptitude safe-upgrade.If full, performs an aptitude full-upgrade.If dist, performs an apt-get dist-upgrade.Note: This does not upgrade a specific package, use state=latest for that. Choices: yes,safe,full,dist. (default: yes)(Added in Ansible version 1.1.)

NOTES

Three of the upgrade modes (full, safe and its alias yes) require aptitude, otherwise apt-get suffices.

EXAMPLES
# Update repositories cache and install "foo" package
- apt: pkg=foo update_cache=yes
# Remove "foo" package
- apt: pkg=foo state=absent
# Install the package "foo"
- apt: pkg=foo state=present
# Install the version '1.00' of package "foo"
- apt: pkg=foo=1.00 state=present
# Update the repository cache and update package "nginx" to latest version using default release squeeze-backport
- apt: pkg=nginx state=latest default_release=squeeze-backports update_cache=yes
# Install latest version of "openjdk-6-jdk" ignoring "install-recommends"
- apt: pkg=openjdk-6-jdk state=latest install_recommends=no
# Update all packages to the latest version
- apt: upgrade=dist
# Run the equivalent of "apt-get update" as a separate step
- apt: update_cache=yes
# Only run "update_cache=yes" if the last one is more than more than 3600 seconds ago
- apt: update_cache=yes cache_valid_time=3600
# Pass options to dpkg on run
- apt: upgrade=dist update_cache=yes dpkg_options='force-confold,force-confdef'

AUTHOR
Matthew Williams

SEE ALSO
ansible(1), http://ansible.github.com/modules.html#apt