manala.apt

#######################################################################################################

:exclamation: DEPRECATION :exclamation:

You can find information on how to use it in the collection repository.

#######################################################################################################

Ansible Role: Apt Build Status

:exclamation: Please report issues and send Pull Requests to the main Ansible Role repository :exclamation:

This role adds third-party sources to the package manager by:

  • Adding the source URL as a new repository
  • Adding the specified secure key
  • Managing package preference files (also known as pinning)
  • Installing packages

It is part of the Manala Ansible stack but can also be used independently.

Requirements

None.

Dependencies

None.

Installation

Ansible 2+

To install using the ansible galaxy command line:

ansible-galaxy install manala.apt

Or, using an ansible galaxy requirements file:

- src: manala.apt

Role Handlers

None

Role Variables

Definition

Name Default Type Description
manala_apt_configs_exclusive false Boolean Whether configurations are exclusive
manala_apt_configs_dir '/etc/apt/apt.conf.d' String Directory for configurations
manala_apt_configs_defaults {} Array Default configurations
manala_apt_configs [] Array Configurations
manala_apt_install_packages ~ Array Packages to install
manala_apt_install_packages_default ['apt-transport-https', 'openssl', 'ca-certificates'] Array Default packages to install
manala_apt_components ['main'] Array Components collection
manala_apt_sources_list_file '/etc/apt/sources.list' String Path for sources list file
manala_apt_sources_list_template ~ String Path for sources list template
manala_apt_sources_list ~ String/Array Sources list
manala_apt_repositories_exclusive false Boolean Whether repositories are exclusive
manala_apt_repositories [] Array Repositories
manala_apt_preferences_exclusive false Boolean Whether preferences are exclusive
manala_apt_preferences_dir '/etc/apt/preferences.d' String Directory for preferences
manala_apt_preferences_defaults {} Array Default preferences
manala_apt_preferences [] Array Preferences
manala_apt_holds_exclusive false Array Holds exclusivity
manala_apt_holds [] Array Holds collection
manala_apt_packages [] Array Package collection
manala_apt_cache_valid_time 3600 Integer Cache age of apt in seconds
manala_apt.update false Boolean Update packages

Example

- hosts: all
  vars:
    manala_apt_repositories:
      - contrib
    manala_apt_preferences:
      - git@backports
      - dotdeb:100
      - php@dotdeb_php56:300
      - nginx@nginx
    manala_apt_packages:
      - xfonts-75dpi
      - http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-{{ ansible_distribution_release }}-amd64.deb
  roles:
    - role: manala.apt

Configs

manala_apt_configs lets you define apt configuration files using either templates or raw content.

You can specify a state (present|absent|ignore).

manala_apt_configs:
  # Template based (file name based on template)
  - template: configs/check_valid_until_false.j2
  # Template based (enforce file name)
  - file: check
    template: configs/check_valid_until_false.j2
  # Content based
  - file: foo_content
    config: |
      APT::Install-Recommends "false";
  # Dictionaries array config (deprecated)
  - file: foo
    config:
      - Acquire::Check-Valid-Until: true
  # Ensure config is absent
  - file: absent
    state: absent # Default is "present"
  # Ignore config
  - file: ignore
    state: ignore
  # Use custom configs
  - "{{ my_custom_configs_array }}"

manala_apt_configs_exclusive allows you to clean up existing apt configuration files in the specified directory to ensure no old or manually created files interfere with the current config.

manala_apt_configs_exclusive: true

Components

Specify apt components:

manala_apt_components:
  - main
  - contrib
  - non-free
  # Use custom components
  - "{{ my_custom_components_array }}"

Sources list

Use a template:

manala_apt_sources_list_template: my/sources.list.j2
manala_apt_sources_list:
  foo: bar

Use raw content:

manala_apt_sources_list: |
  deb http://deb.debian.org/debian {{ ansible_distribution_release }} main
  deb http://security.debian.org/debian-security {{ ansible_distribution_release }}/updates main
  deb http://deb.debian.org/debian {{ ansible_distribution_release }}-updates main

Repositories

Simple, pattern-based

manala_apt_repositories:
  - security
  - updates
  - partner
  - backports

Detailed, pattern-based

manala_apt_repositories:
  - pattern: backports
    state: absent

Detailed

manala_apt_repositories:
  - source: deb http://pkg.jenkins-ci.org/debian binary/
    key:
      url: http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key
      id:  D50582E6
  # Ignore repository
  - source: deb https://example.com foo
    state: ignore
  # Use custom repositories
  - "{{ my_custom_repositories_array }}"

Exclusivity (removes all other repositories not defined by the role):

manala_apt_repositories_exclusive: true

Preferences

Simple, pattern-based

Format: [preference pattern]@[repository pattern]:[pin priority]

manala_apt_preferences:
  - git@backports
  - dotdeb:100
  - php@dotdeb

Detailed

manala_apt_preferences:
  - package:  '*'
    pin:      release o=Debian,a=stable
    priority: 600
    file:     dotdeb
  # Ignore preference
  - file: foo
  # Use custom preferences
  - "{{ my_custom_preferences_array }}"

Holds

Manage packages you want to keep from upgrading:

manala_apt_holds:
  - foo # Prevent "foo" from upgrading
  - package: bar # Same for "bar"
  # Ignore hold
  - package: qux
  # Deprecated
  - package: quux
    hold: true # or false :)
  # Use custom holds
  - "{{ my_custom_holds_array }}"

Exclusivity mode ensures only your specified packages are upgradeable.

manala_apt_holds_exclusive: true

Packages

Simple

manala_apt_packages:
  - vim # Package name

Detailed

manala_apt_packages:
  - package:  bzip2  # Package name, required
    state: absent # Optional state, default "present"
    force: true   # Optional force installation
  # Ignore package
  - package: foo
    state: ignore
  # Use custom packages
  - "{{ my_custom_packages_array }}"

Flags

To update packages:

manala_apt:
  update: true

# Can also be set for all manala roles
manala:
  update: true

Licence

MIT

Author information

Manala (http://www.manala.io/)

Informazioni sul progetto

Handle apt

Installa
ansible-galaxy install manala.apt
Licenza
Unknown
Download
73k
Proprietario
Manala is an open source project supported by the french web agency ELAO providing advanced ansible roles for website's infrastructures and far more.