community.general.snap_connect module – Manages snap interface connections
Note
This module is part of the community.general collection (version 12.6.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 |
|---|---|
plug string / required | The plug endpoint in the format |
slot string | The slot endpoint in the format If not specified, snapd will attempt to find a matching slot automatically. |
state string | Desired state of the connection. Choices:
|
Attributes
Attribute | Support | Description |
|---|---|---|
check_mode | Support: full | Can run in |
diff_mode | 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 |
|---|---|
snap_connections list / elements=dictionary | The list of snap connections after execution. Returned: always |
|
interface string |
The interface name. Returned: success |
|
plug string |
The plug endpoint. Returned: success |
|
slot string |
The slot endpoint. Returned: success |
version dictionary | Versions of snap components as reported by Returned: always |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/community/general/snap_connect_module.html