- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# flatpak – Manage flatpaks

New in version 2.6.

- Synopsis

- Requirements

- Parameters

- Examples

- Return Values

- Status

## Synopsis

- Allows users to add or remove flatpaks.

- See the flatpak_remote module for managing flatpak remotes.

## Requirements

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

- flatpak

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
executable - | Default: "flatpak" | The path to the `flatpak` executable to use. By default, this module looks for the `flatpak` executable on the path.
method - | Choices: system ← user | The installation method to use. Defines if the flatpak is supposed to be installed globally for the whole `system` or only for the current `user`.
name - / required |  | The name of the flatpak to manage. When used with state=present, name can be specified as an `http(s`) URL to a `flatpakref` file or the unique reverse DNS name that identifies a flatpak. When supplying a reverse DNS name, you can use the remote option to specify on what remote to look for the flatpak. An example for a reverse DNS name is `org.gnome.gedit`. When used with state=absent, it is recommended to specify the name in the reverse DNS format. When supplying an `http(s`) URL with 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.
remote - | Default: "flathub" | The flatpak remote (repository) to install the flatpak from. By default, `flathub` is assumed, but you do need to add the flathub flatpak_remote before you can use this. See the flatpak_remote module for managing flatpak remotes.
state - | Choices: absent present ← | Indicates the desired package state.

## Examples

    - name: Install the spotify flatpak
      flatpak:
        name:  https://s3.amazonaws.com/alexlarsson/spotify-repo/spotify.flatpakref
        state: present

    - name: Install the gedit flatpak package
      flatpak:
        name: https://git.gnome.org/browse/gnome-apps-nightly/plain/gedit.flatpakref
        state: present

    - name: Install the gedit package from flathub for current user
      flatpak:
        name: org.gnome.gedit
        state: present
        method: user

    - name: Install the Gnome Calendar flatpak from the gnome remote system-wide
      flatpak:
        name: org.gnome.Calendar
        state: present
        remote: gnome

    - name: Remove the gedit flatpak
      flatpak:
        name: org.gnome.gedit
        state: absent

## Return Values

Common return values are documented here, the following are the fields unique to this module:

Key | Returned | Description
--- | --- | ---
command string | When a flatpak command has been executed | The exact flatpak command that was executed Sample: /usr/bin/flatpak install --user -y flathub org.gnome.Calculator
msg string | failure | Module error message Sample: Executable '/usr/local/bin/flatpak' was not found on the system.
rc integer | When a flatpak command has been executed | Return code from flatpak binary
stderr string | When a flatpak command has been executed | Error output from flatpak binary Sample: error: Error searching remote flathub: Can't find ref org.gnome.KDE
stdout string | When a flatpak command has been executed | Output from flatpak binary Sample: org.gnome.Calendar/x86_64/stable current org.gnome.gitg/x86_64/stable current

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]

- This module is maintained by the Ansible Community. [community]

### Authors

- John Kwiatkoski (@JayKayy)

- Alexander Bethke (@oolongbrothers)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.