community.general.snap_connect module – Manages snap interface connections
Note
This module is part of the community.general collection (version 13.0.1).
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_connect.
New in community.general 12.6.0
Synopsis
Manages connections between snap plugs and slots.
Snaps run in a sandbox and need explicit interface connections to access system resources or communicate with other snaps.
Parameters
Parameter |
Comments |
|---|---|
The plug endpoint in the format |
|
The slot endpoint in the format If not specified, snapd will attempt to find a matching slot automatically. |
|
Desired state of the connection. Choices:
|
Attributes
Attribute |
Support |
Description |
|---|---|---|
Support: full |
Can run in |
|
Support: full |
Returns details on what has changed (or possibly needs changing in |
Notes
Note
Privileged operations require root privileges.
See Also
See also
- community.general.snap
Manages snaps.
- community.general.snap_alias
Manages snap aliases.
Examples
- name: Connect firefox camera plug to system camera slot
community.general.snap_connect:
plug: firefox:camera
slot: ":camera"
- name: Connect snap plug (slot resolved automatically by snapd)
community.general.snap_connect:
plug: my-app:network
- name: Disconnect a specific connection
community.general.snap_connect:
plug: firefox:camera
slot: ":camera"
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
The list of snap connections after execution. Returned: always |
|
The interface name. Returned: success |
|
The plug endpoint. Returned: success |
|
The slot endpoint. Returned: success |
|
Versions of snap components as reported by Returned: always |