Manage snaps

These examples will show you how to set up snapd and install snap packages.

For a full list of keys, refer to the snap module schema.

General usage

 1#cloud-config
 2snap:
 3  assertions:
 4    00: |
 5      signed_assertion_blob_here
 6    02: |
 7      signed_assertion_blob_here
 8  commands:
 9    00: snap create-user --sudoer --known <snap-user>@mydomain.com
10    01: snap install canonical-livepatch
11    02: canonical-livepatch enable <AUTH_TOKEN>

Omitting the snap command

For convenience, the snap command can be omitted when specifying commands as a list, and 'snap' will automatically be prepended. The following commands are all equivalent:

1#cloud-config
2snap:
3  commands:
4    0: [install, vlc]
5    1: [snap, install, vlc]
6    2: snap install vlc
7    3: snap install vlc

Using lists

You can use a list of commands:

1#cloud-config
2snap:
3  commands:
4  - [install, vlc]
5  - [snap, install, vlc]
6  - snap install vlc
7  - snap install vlc

And you can also use a list of assertions:

1#cloud-config
2snap:
3  assertions:
4    - signed_assertion_blob_here
5    - |
6      signed_assertion_blob_here