AnsiblePilot — Master Ansible Automation
AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.
Popular Topics
About Luca Berton
Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.
Install Spotify snap in Debian-like systems - Ansible module snap — Video Tutorial
How to automate the installation of Spotify snap system-wide in Debian-like systems using Ansible module snap.
What You'll Learn
- How to Install Spotify snap on Debian-like systems with Ansible?
- Ansible installs Spotify snap on Debian-like systems
- Parameters
- Links
- code
- execution
- idempotency
- before execution
- after execution
- Conclusion
Full Tutorial Content
How to Install Spotify snap on Debian-like systems with Ansible?
I'm going to show you a live Playbook with some simple Ansible code.
I'm Luca Berton and welcome to today's episode of Ansible Pilot.
Ansible installs Spotify snap on Debian-like systems
- `community.general.snap`
- Manages snaps
Today we are going to talk about the Ansible module `snap`.
The full name is `community.general.snap`, it's part of `community.general` modules maintained by the Ansible Community.
The purpose of the `snap` module is to Manage snaps in the target system.
Parameters
- name _string_ - snap name
- state _string_ - present/absent
- channel _string_ - "stable"
- classic _boolean_ - no/yes
Let me summarize the parameters of `snap` module.
The only required is "name", where you specify the snap name to install or remove.
The parameter "state" specifies if you would like to perform the install action ("present" option) or the remove action ("absent" option).
The parameter "channel" specifies which channel to use, default the "stable" channel.
The parameter "classic" allows the confinement allows a snap to have the same level of access to the system as "classic" packages.
Links
- [community.general.snap](https://docs.ansible.com/ansible/latest/collections/community/general/snap_module.html)
- [spotify snap](https://snapcraft.io/spotify)
## Playbook
code
```yaml
---
- name: snap module Playbook
hosts: all
become: true
gather_facts: false
tasks:
- name: snapd present
ansible.builtin.apt:
name: snapd
state: present
- name: install Spotify via snap
community.general.snap:
name: spotify
state: present
```
execution
```bash
ansible-pilot $ ansible-playbook -i virtualmachines/ubuntu2110desktop/inventory container/snap_debian.yml
PLAY [snap module Playbook] ***************************************************************************
TASK [snapd present] ******************************************************************************
ok: [ubuntu2110.example.com]
TASK [install Spotify via snap] *******************************************************************
changed: [ubuntu2110.example.com]
PLAY RECAP ****************************************************************************************
ubuntu2110.example.com : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
ansible-pilot $
```
idempotency
```bash
ansible-pilot $ ansible-playbook -i virtualmachines/ubuntu2110desktop/inventory container/snap_debian.yml
PLAY [snap module Playbook] ***************************************************************************
TASK [snapd present] ******************************************************************************
ok: [ubuntu2110.example.com]
TASK [install Spotify via snap] *******************************************************************
ok: [ubuntu2110.example.com]
PLAY RECAP ****************************************************************************************
About This Tutorial
- Author: Luca Berton
- Difficulty: Beginner
- Read time: 3 min
- Category: installation
Read the full written article: Install Spotify snap in Debian-like systems - Ansible module snap
Related Video Tutorials
- Install Docker in Debian-like systems - Ansible module apt_key, apt_repository and apt — How to automate the installation of the docker-ce engine in Ubuntu 20.04 LTS x86_64 (or amd64) using Ansible Playbook.
- Install Zoom flatpak in Debian-like systems - Ansible module flatpak — How to automate the installation of Zoom flatpak system-wide in Debian-like systems using Ansible module flatpak.
- Install Google Chrome in Debian like systems - Ansible module apt_key, apt_repository and apt — How to install the latest Google Chrome Stable on a Debian-like workstation (Debian, Ubuntu, Linux Mint, MX Linux, Deepin, AntiX, PureOS, Kali Linux, Parrot.
- Install Microsoft Edge on Debian with Ansible — Learn how to install Microsoft Edge on Debian using Ansible. Follow our guide for a smooth setup process, including repository and key additions.
- Install PostgreSQL in Debian-like systems - Ansible modules apt, stat, shell, service — How to automate the installation of PostgreSQL on Debian-like systems: installing the necessary packages and dependency, initializing the configuration.
- Ansible apt Module: Install Packages on Ubuntu/Debian (Examples) — How to install, remove, and update packages on Ubuntu, Debian, and Linux Mint using Ansible's apt module.