community.general.portage – Package manager for Gentoo

Note

This plugin is part of the community.general collection (version 3.8.3).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.portage.

Synopsis

  • Manages Gentoo packages

Requirements

The below requirements are needed on the host that executes this module.

  • gentoolkit

Parameters

Parameter

Comments

changed_use

boolean

Include installed packages where USE flags have changed, except when

flags that the user has not enabled are added or removed

(–changed-use)

Choices:

  • no ← (default)

  • yes

deep

boolean

Consider the entire dependency tree of packages (–deep)

Choices:

  • no ← (default)

  • yes

depclean

boolean

Remove packages not needed by explicitly merged packages (–depclean)

If no package is specified, clean up the world’s dependencies

Otherwise, –depclean serves as a dependency aware version of –unmerge

Choices:

  • no ← (default)

  • yes

getbinpkg

boolean

Prefer packages specified at PORTAGE_BINHOST in make.conf.

Choices:

  • no ← (default)

  • yes

getbinpkgonly

boolean

added in 1.3.0 of community.general

Merge only packages specified at PORTAGE_BINHOST in make.conf.

Choices:

  • no ← (default)

  • yes

jobs

integer

Specifies the number of packages to build simultaneously.

Since version 2.6: Value of 0 or False resets any previously added

–jobs setting values

keepgoing

boolean

Continue as much as possible after an error.

Choices:

  • no ← (default)

  • yes

loadavg

float

Specifies that no new builds should be started if there are

other builds running and the load average is at least LOAD

Since version 2.6: Value of 0 or False resets any previously added

–load-average setting values

newuse

boolean

Include installed packages where USE flags have changed (–newuse)

Choices:

  • no ← (default)

  • yes

nodeps

boolean

Only merge packages but not their dependencies (–nodeps)

Choices:

  • no ← (default)

  • yes

noreplace

boolean

Do not re-emerge installed packages (–noreplace)

Choices:

  • no

  • yes ← (default)

oneshot

boolean

Do not add the packages to the world file (–oneshot)

Choices:

  • no ← (default)

  • yes

onlydeps

boolean

Only merge packages’ dependencies but not the packages (–onlydeps)

Choices:

  • no ← (default)

  • yes

package

aliases: name

list / elements=string

Package atom or set, e.g. sys-apps/foo or >foo-2.13 or @world

quiet

boolean

Run emerge in quiet mode (–quiet)

Choices:

  • no ← (default)

  • yes

quietbuild

boolean

Redirect all build output to logs alone, and do not display it

on stdout (–quiet-build)

Choices:

  • no ← (default)

  • yes

quietfail

boolean

Suppresses display of the build log on stdout (–quiet-fail)

Only the die message and the path of the build log will be

displayed on stdout.

Choices:

  • no ← (default)

  • yes

state

string

State of the package atom

Choices:

  • present ← (default)

  • installed

  • emerged

  • absent

  • removed

  • unmerged

  • latest

sync

string

Sync package repositories first

If yes, perform “emerge –sync”

If web, perform “emerge-webrsync”

Choices:

  • web

  • yes

  • no

update

boolean

Update packages to the best version available (–update)

Choices:

  • no ← (default)

  • yes

usepkg

boolean

Tries to use the binary package(s) in the locally available packages directory.

Choices:

  • no ← (default)

  • yes

usepkgonly

boolean

Merge only binaries (no compiling).

Choices:

  • no ← (default)

  • yes

verbose

boolean

Run emerge in verbose mode (–verbose)

Choices:

  • no ← (default)

  • yes

Examples

- name: Make sure package foo is installed
  community.general.portage:
    package: foo
    state: present

- name: Make sure package foo is not installed
  community.general.portage:
    package: foo
    state: absent

- name: Update package foo to the latest version (os specific alternative to latest)
  community.general.portage:
    package: foo
    update: yes

- name: Install package foo using PORTAGE_BINHOST setup
  community.general.portage:
    package: foo
    getbinpkg: yes

- name: Re-install world from binary packages only and do not allow any compiling
  community.general.portage:
    package: '@world'
    usepkgonly: yes

- name: Sync repositories and update world
  community.general.portage:
    package: '@world'
    update: yes
    deep: yes
    sync: yes

- name: Remove unneeded packages
  community.general.portage:
    depclean: yes

- name: Remove package foo if it is not explicitly needed
  community.general.portage:
    package: foo
    state: absent
    depclean: yes

Authors

  • William L Thomson Jr (@wltjr)

  • Yap Sok Ann (@sayap)

  • Andrew Udvare (@Tatsh)