ansible.builtin.flatpak (v2.9.27) — module

Manage flatpaks

| "added in version" 2.6 of ansible.builtin"

Authors: John Kwiatkoski (@JayKayy), Alexander Bethke (@oolongbrothers)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Allows users to add or remove flatpaks.

See the M(flatpak_remote) module for managing flatpak remotes.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install the spotify flatpak
  flatpak:
    name:  https://s3.amazonaws.com/alexlarsson/spotify-repo/spotify.flatpakref
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install the gedit flatpak package
  flatpak:
    name: https://git.gnome.org/browse/gnome-apps-nightly/plain/gedit.flatpakref
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install the gedit package from flathub for current user
  flatpak:
    name: org.gnome.gedit
    state: present
    method: user
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install the Gnome Calendar flatpak from the gnome remote system-wide
  flatpak:
    name: org.gnome.Calendar
    state: present
    remote: gnome
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove the gedit flatpak
  flatpak:
    name: org.gnome.gedit
    state: absent

Inputs

    
name:
    description:
    - The name of the flatpak to manage.
    - When used with I(state=present), I(name) can be specified as an C(http(s)) URL to
      a C(flatpakref) file or the unique reverse DNS name that identifies a flatpak.
    - When supplying a reverse DNS name, you can use the I(remote) option to specify on
      what remote to look for the flatpak. An example for a reverse DNS name is C(org.gnome.gedit).
    - When used with I(state=absent), it is recommended to specify the name in the reverse
      DNS format.
    - When supplying an C(http(s)) URL with I(state=absent), the module will try to match
      the installed flatpak based on the name of the flatpakref to remove it. However,
      there is no guarantee that the names of the flatpakref file and the reverse DNS
      name of the installed flatpak do match.
    required: true

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Indicates the desired package state.

method:
    choices:
    - system
    - user
    default: system
    description:
    - The installation method to use.
    - Defines if the I(flatpak) is supposed to be installed globally for the whole C(system)
      or only for the current C(user).

remote:
    default: flathub
    description:
    - The flatpak remote (repository) to install the flatpak from.
    - By default, C(flathub) is assumed, but you do need to add the flathub flatpak_remote
      before you can use this.
    - See the M(flatpak_remote) module for managing flatpak remotes.

executable:
    default: flatpak
    description:
    - The path to the C(flatpak) executable to use.
    - By default, this module looks for the C(flatpak) executable on the path.

Outputs

command:
  description: The exact flatpak command that was executed
  returned: When a flatpak command has been executed
  sample: /usr/bin/flatpak install --user -y flathub org.gnome.Calculator
  type: str
msg:
  description: Module error message
  returned: failure
  sample: Executable '/usr/local/bin/flatpak' was not found on the system.
  type: str
rc:
  description: Return code from flatpak binary
  returned: When a flatpak command has been executed
  sample: 0
  type: int
stderr:
  description: Error output from flatpak binary
  returned: When a flatpak command has been executed
  sample: 'error: Error searching remote flathub: Can''t find ref org.gnome.KDE'
  type: str
stdout:
  description: Output from flatpak binary
  returned: When a flatpak command has been executed
  sample: "org.gnome.Calendar/x86_64/stable\tcurrent\norg.gnome.gitg/x86_64/stable\t\
    current\n"
  type: str