community.general.flatpak 模块 – 管理 flatpaks
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。您需要其他要求才能使用此模块,请参阅 要求 了解详情。
要在 playbook 中使用它,请指定:community.general.flatpak。
概要
- 允许用户添加或删除 flatpak。 
- 有关管理 flatpak 远程的信息,请参阅 community.general.flatpak_remote 模块。 
要求
执行此模块的主机需要以下要求。
- flatpak 
参数
| 参数 | 注释 | 
|---|---|
| 要使用的  默认情况下,此模块会在路径上查找  默认值:  | |
| 要使用的安装方法。 定义  选择 
 | |
| 要管理的 flatpak 的名称。要操作多个软件包,这可以接受一个软件包列表。 与  支持  当提供反向 DNS 名称时,您可以使用  当与  当使用  | |
| 是否应省略安装运行时依赖项 此参数主要用于集成测试此模块。但是,在您打包自己的 flatpak 时,可能有一些您希望这样做的情况。 选择 
 | |
| 用于安装 flatpak 的 flatpak 远程仓库。 默认情况下,假设为  有关管理 flatpak 远程的信息,请参阅 community.general.flatpak_remote 模块。 默认值:  | |
| 指示期望的软件包状态。 从 community.general 8.6.0 版本开始支持值  选择 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持: 部分 如果  | 可以在  | |
| 支持: 无 | 在差异模式下,将返回有关已更改内容(或在  | 
示例
- name: Install the spotify flatpak
  community.general.flatpak:
    name:  https://s3.amazonaws.com/alexlarsson/spotify-repo/spotify.flatpakref
    state: present
- 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
- name: Install the gedit package from flathub for current user
  community.general.flatpak:
    name: org.gnome.gedit
    state: present
    method: user
- name: Install the Gnome Calendar flatpak from the gnome remote system-wide
  community.general.flatpak:
    name: org.gnome.Calendar
    state: present
    remote: gnome
- name: Install multiple packages
  community.general.flatpak:
    name:
      - org.gimp.GIMP
      - org.inkscape.Inkscape
      - org.mozilla.firefox
- name: Update the spotify flatpak
  community.general.flatpak:
    name:  https://s3.amazonaws.com/alexlarsson/spotify-repo/spotify.flatpakref
    state: latest
- name: Update the gedit flatpak package without dependencies (not recommended)
  community.general.flatpak:
    name: https://git.gnome.org/browse/gnome-apps-nightly/plain/gedit.flatpakref
    state: latest
    no_dependencies: true
- name: Update the gedit package from flathub for current user
  community.general.flatpak:
    name: org.gnome.gedit
    state: latest
    method: user
- name: Update the Gnome Calendar flatpak from the gnome remote system-wide
  community.general.flatpak:
    name: org.gnome.Calendar
    state: latest
    remote: gnome
- name: Update multiple packages
  community.general.flatpak:
    name:
      - org.gimp.GIMP
      - org.inkscape.Inkscape
      - org.mozilla.firefox
    state: latest
- name: Remove the gedit flatpak
  community.general.flatpak:
    name: org.gnome.gedit
    state: absent
- name: Remove multiple packages
  community.general.flatpak:
    name:
      - org.gimp.GIMP
      - org.inkscape.Inkscape
      - org.mozilla.firefox
    state: absent
返回值
常见的返回值记录在这里,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 执行的确切 flatpak 命令 已返回:当已执行 flatpak 命令时 示例:  | |
| 模块错误消息 已返回:失败 示例:  | |
| 来自 flatpak 二进制文件的返回代码 已返回:当已执行 flatpak 命令时 示例:  | |
| 来自 flatpak 二进制文件的错误输出 已返回:当已执行 flatpak 命令时 示例:  | |
| 来自 flatpak 二进制文件的输出 已返回:当已执行 flatpak 命令时 示例:  | 
