community.general.flatpak (8.5.0) — module

Manage flatpaks

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

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Allows users to add or remove flatpaks.

See the M(community.general.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
  community.general.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 without dependencies (not recommended)
  community.general.flatpak:
    name: https://git.gnome.org/browse/gnome-apps-nightly/plain/gedit.flatpakref
    state: present
    no_dependencies: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install the gedit package from flathub for current user
  community.general.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
  community.general.flatpak:
    name: org.gnome.Calendar
    state: present
    remote: gnome
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install multiple packages
  community.general.flatpak:
    name:
      - org.gimp.GIMP
      - org.inkscape.Inkscape
      - org.mozilla.firefox
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove the gedit flatpak
  community.general.flatpak:
    name: org.gnome.gedit
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove multiple packages
  community.general.flatpak:
    name:
      - org.gimp.GIMP
      - org.inkscape.Inkscape
      - org.mozilla.firefox
    state: absent

Inputs

    
name:
    description:
    - The name of the flatpak to manage. To operate on several packages this can accept
      a list of packages.
    - When used with O(state=present), O(name) can be specified as a URL to a C(flatpakref)
      file or the unique reverse DNS name that identifies a flatpak.
    - Both C(https://) and C(http://) URLs are supported.
    - When supplying a reverse DNS name, you can use the O(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 O(state=absent), it is recommended to specify the name in the reverse
      DNS format.
    - When supplying a URL with O(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.
    elements: str
    required: true
    type: list

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

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

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

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.
    type: path

no_dependencies:
    default: false
    description:
    - If installing runtime dependencies should be omitted or not
    - This parameter is primarily implemented for integration testing this module. There
      might however be some use cases where you would want to have this, like when you
      are packaging your own flatpaks.
    type: bool
    version_added: 3.2.0
    version_added_collection: community.general

Outputs

command:
  description: The exact flatpak command that was executed
  returned: When a flatpak command has been executed
  sample: /usr/bin/flatpak install --user --nontinteractive 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