community.general.snap_alias module – Manages snap aliases

Note

This module is part of the community.general collection (version 8.3.0).

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

New in community.general 4.0.0

Synopsis

  • Manages snaps aliases.

Aliases: packaging.os.snap_alias

Parameters

Parameter

Comments

alias

aliases: aliases

list / elements=string

Aliases to be created or removed.

name

string

Name of the snap.

state

string

Desired state of the alias.

Choices:

  • "absent"

  • "present" ← (default)

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: full

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

See Also

See also

community.general.snap

Manages snaps.

Examples

# Install "foo" and "bar" snap
- name: Create snap alias
  community.general.snap_alias:
    name: hello-world
    alias: hw

- name: Create multiple aliases
  community.general.snap_alias:
    name: hello-world
    aliases:
      - hw
      - hw2
      - hw3
    state: present   # optional

- name: Remove one specific aliases
  community.general.snap_alias:
    name: hw
    state: absent

- name: Remove all aliases for snap
  community.general.snap_alias:
    name: hello-world
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

snap_aliases

list / elements=string

The snap aliases after execution. If called in check mode, then the list represents the state before execution.

Returned: always

Authors

  • Alexei Znamensky (@russoz)