community.general.snap 模块 – 管理 snaps
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您正在使用 ansible
包,则您可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install community.general
。
要在 playbook 中使用它,请指定: community.general.snap
。
概要
管理 snaps 包。
参数
参数 |
注释 |
---|---|
定义安装和跟踪更新的 snap 版本。此选项仅当任务中只有一个 snap 时才能指定。 如果未传递,则 如果传递的值不包含 有关 snap 通道的更多详细信息,请参阅 https://snapcraft.io/docs/channels。 |
|
安装具有 classic 限制的 snap。 此选项对应于 此限制级别是宽松的,授予完全的系统访问权限,类似于不使用沙箱机制的传统打包应用程序。此选项仅当任务涉及单个 snap 时才能指定。 有关 classic 限制和限制级别的更多详细信息,请参阅 https://snapcraft.io/docs/snap-confinement。 选项
|
|
以危险模式安装 snap,不验证其声明和签名。 这在安装未签名或签名未被确认的本地 snaps 时很有用。 有关安装模式的更多详细信息,请参阅 https://snapcraft.io/docs/install-modes。 选项
|
|
使用模式 仅当 有关 snap 配置选项的更多详细信息,请参阅 https://snapcraft.io/docs/configuration-in-snaps。 |
|
包的所需状态。 当 选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持:完全支持 |
可以在 |
|
支持:不支持 |
在差异模式下,将返回有关已更改内容(或可能需要在 |
备注
注意
特权操作(例如安装和配置 snaps)需要 root 权限。只有在用户未登录 Snap 商店的情况下才如此。
另请参阅
另请参阅
- community.general.snap_alias
管理 snap 别名。
示例
# Install "foo" and "bar" snap
- name: Install foo
community.general.snap:
name:
- foo
- bar
# Install "foo" snap with options par1=A and par2=B
- name: Install "foo" with options
community.general.snap:
name:
- foo
options:
- par1=A
- par2=B
# Install "foo" and "bar" snaps with common option com=A and specific options fooPar=X and barPar=Y
- name: Install "foo" and "bar" with options
community.general.snap:
name:
- foo
- bar
options:
- com=A
- foo:fooPar=X
- bar:barPar=Y
# Remove "foo" snap
- name: Remove foo
community.general.snap:
name: foo
state: absent
# Install a snap with classic confinement
- name: Install "foo" with option --classic
community.general.snap:
name: foo
classic: true
# Install a snap with from a specific channel
- name: Install "foo" with option --channel=latest/edge
community.general.snap:
name: foo
channel: latest/edge
返回值
常见的返回值已在此处记录,以下是此模块特有的字段
键 |
描述 |
---|---|
安装 snaps 的通道 返回:当安装 snaps 时 |
|
snaps 是否使用经典限制安装 返回:当安装 snaps 时 |
|
在主机上执行的命令 返回:当 changed 为 true 时 |
|
已设置/更改的选项列表,格式为 返回:当任何选项已更改/设置时 |
|
实际安装的 snaps 列表 返回:当任何 snaps 已安装时 |
|
实际删除的 snaps 列表 返回:当任何 snaps 已删除时 |