apt_repository - Add and remove APT repositores

Author:Alexander Saltanov

Synopsis

Add or remove an APT repositories in Ubuntu and Debian.

Options

parameter required default choices comments
repo yes none
    A source string for the repository.
    state no present
    • absent
    • present
    A source string state.
    update_cache no yes
    • yes
    • no
    Run the equivalent of apt-get update if has changed.

    Note

    Requires python-apt

    Note

    Requires python-pycurl

    Examples


    # Add specified repository into sources list.
    apt_repository: repo='deb http://archive.canonical.com/ubuntu hardy partner' state=present
    
    # Add source repository into sources list.
    apt_repository: repo='deb-src http://archive.canonical.com/ubuntu hardy partner' state=present
    
    # Remove specified repository from sources list.
    apt_repository: repo='deb http://archive.canonical.com/ubuntu hardy partner' state=absent
    
    # On Ubuntu target: add nginx stable repository from PPA and install its signing key.
    # On Debian target: adding PPA is not available, so it will fail immediately.
    apt_repository: repo='ppa:nginx/stable'
    

    Note

    This module works on Debian and Ubuntu and requires python-apt and python-pycurl packages.

    Note

    This module supports Debian Squeeze (version 6) as well as its successors.

    Note

    This module treats Debian and Ubuntu distributions separately. So PPA could be installed only on Ubuntu machines.

    Table Of Contents

    Previous topic

    apt_key - Add or remove an apt key

    Next topic

    easy_install - Installs Python libraries