Ansible series (7) apt Module

Source: Internet
Author: User

Ansible series (7) apt Module
Apt Module

This module is the most used when ubuntu is the OS of a remote node. Apt is a package management tool for ubuntu/debian.

Module Parameters
Parameter Name Required? Default Value Option value Parameter description
Cache_valid_time No     IfUpdate_cacheThis parameter takes effect only when it takes effect. Used to controlUpdate_cacheOverall validity period
Deb No     This software package is used to install the. deb suffix on the remote machine.
Default_release No     This is equivalent to the-t option of the apt command.
Force No No Yes/no Force execute apt install/remove
Install_recommends No Ture Yes/no This parameter can be used to control whether the software package is downloaded or installed on the remote computer. The default parameter is true. If it is set to false, the software package is downloaded without installation.
Name No     The name of the software package to be downloaded by apt. SupportedName = git = 1.6This developed version Model
Purge No   Yes/no IfStateThe parameter value isAbsent, This parameter isYesWill be forcibly uninstalled
State No Present Latest/absent/present Define the final state of the software package,LatestInstall the latest software
Update_cache No   Yes/no When this parameter isYesIs equalApt-get update
Upgrade No Yes Yes/safe/full/dist If the parameter isYesOrSafe, Equivalent to apt-get upgrade.FullIs the complete update. If yesDistEqual to apt-get dist-upgrade.
Use Cases
# Update and install the foo-apt: name = foo update_cache = yes # Remove the foo package-apt: name = foo state = absent # Install the foo package-apt: name = foo state = present # Install the foo 1.0 software package-apt: name = foo = 1.00 state = present # The latest nginx installation name is squeeze-backport release package, and execute Update-apt: name = nginx state = latest default_release = squeeze-backports update_cache = yes # Only download the latest openjdk-6-jdk package, do not install-apt: name = openjdk-6-jdk state = latest install_recommends = no # Install all packages to the latest version-apt: upgrade = dist # update apt-get list-apt: update_cache = yes # Stop update_cache in 3600 seconds-apt: update_cache = yes cache_valid_time = 3600 # Install/tmp/mypackage on the remote node. deb package-apt: deb =/tmp/mypackage. deb

These are examples of common usage on the official website. Will you use it? Next we will talk about zypper.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.