community / community.general / 6.6.8 / module / snap Manages snaps Authors: Victor Carceler (@vcarceler) <vcarceler@iespuigcastellar.xeill.net>, Stanislas Lange (@angristan) <angristan@pm.me>community.general.snap (6.6.8) — module
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
Manages snaps packages.
# 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
name: description: - Name of the snaps. elements: str required: true type: list state: choices: - absent - present - enabled - disabled default: present description: - Desired state of the package. required: false type: str channel: default: stable description: - 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. required: false type: str classic: default: false description: - 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 --classic argument. This option can only be specified if there is a single snap in the task. required: false type: bool options: description: - Set options with pattern C(key=value) or C(snap:key=value). If a snap name is given, the option will be applied to that snap only. If the snap name is omitted, the options will be applied to all snaps listed in I(name). Options will only be applied to active snaps. elements: str required: false type: list version_added: 4.4.0 version_added_collection: community.general
channel: description: The channel the snaps were installed from returned: When snaps are installed type: str classic: description: Whether or not the snaps were installed with the classic confinement returned: When snaps are installed type: bool cmd: description: The command that was executed on the host returned: When changed is true type: str options_changed: description: The list of options set/changed in format C(snap:key=value). returned: When any options have been changed/set type: list version_added: 4.4.0 version_added_collection: community.general snaps_installed: description: The list of actually installed snaps returned: When any snaps have been installed type: list snaps_removed: description: The list of actually removed snaps returned: When any snaps have been removed type: list