community.general.snap module – Manages snaps
Note
This module is part of the community.general collection (version 7.5.2).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.snap
.
Synopsis
Manages snaps packages.
Aliases: packaging.os.snap
Parameters
Parameter |
Comments |
---|---|
Define which release of a snap is installed and tracked for updates. This option can only be specified if there is a single snap in the task. If not passed, the If the value passed does not contain the See https://snapcraft.io/docs/channels for more details about snap channels. |
|
Confinement policy. The classic confinement allows a snap to have the same level of access to the system as “classic” packages, like those managed by APT. This option corresponds to the Choices:
|
|
Install the given snap file even if there are no pre-acknowledged signatures for it, meaning it was not verified and could be dangerous. Choices:
|
|
Name of the snaps to be installed. Any named snap accepted by the Notice that snap files might require |
|
Set options with pattern |
|
Desired state of the package. When Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
See Also
See also
- community.general.snap_alias
Manages snap aliases.
Examples
# 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
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The channel the snaps were installed from Returned: When snaps are installed |
|
Whether or not the snaps were installed with the classic confinement Returned: When snaps are installed |
|
The command that was executed on the host Returned: When changed is true |
|
The list of options set/changed in format Returned: When any options have been changed/set |
|
The list of actually installed snaps Returned: When any snaps have been installed |
|
The list of actually removed snaps Returned: When any snaps have been removed |