ansible.builtin.snap (v2.9.27) — module

Manages snaps

| "added in version" 2.8 of ansible.builtin"

Authors: Victor Carceler (@vcarceler) <vcarceler@iespuigcastellar.xeill.net>, Stanislas Lange (@angristan) <angristan@pm.me>

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Manages snaps packages.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Install "foo" and "bar" snap
- name: Install foo
  snap:
    name:
      - foo
      - bar
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove "foo" snap
- name: Remove foo
  snap:
    name: foo
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Install a snap with classic confinement
- name: Install "foo" with option --classic
  snap:
    name: foo
    classic: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Install a snap with from a specific channel
- name: Install "foo" with option --channel=latest/edge
  snap:
    name: foo
    channel: latest/edge

Inputs

    
name:
    description:
    - Name of the snap to install or remove. Can be a list of snaps.
    required: true

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Desired state of the package.
    required: false

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

Outputs

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
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