professormanhattan.snapd

Snap - A Package Manager for Linux

Created by Megabyte Labs



An Ansible role that ensures Snap is installed and set up on Linux systems


Table of Contents

Overview

This repository contains an Ansible role that ensures Snap is installed and set up properly on Linux systems. Snap is a system made by Canonical for packaging and deploying software on Linux operating systems. Snap packages, known as snaps, and the tool snapd can work with many Linux distributions, allowing developers to deliver their applications directly to users. Snaps are self-sufficient applications that run in a controlled environment with limited access to the host system.

Features

Ensures Snap is installed:

  • Installs Snap on Linux systems.
  • Starts and enables Snap to launch on system boot.

Quick Start

Want to install Snap without using Ansible? Just run the following command for your operating system:

Linux/macOS:

curl -sS https://install.doctor/snapd | bash

Windows:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://install.doctor/snapd?os=win'))

Important Note: Before you run these commands, it's a good idea to check the URL to ensure the code is safe. We know it's secure, but it's always smart to verify before running scripts on your system.

You can also try out Install Doctor. It’s an app we created that can install any Ansible role with one command. It has other features, like installing binaries right away without needing a password. If you want to use this role in an Ansible playbook and customize settings, keep reading below.

Supported Operating Systems

The table below lists the operating systems we’ve tested this role on. It's automatically generated using Ansible Molecule tests in the molecule/ folder. Our CI system automatically tests Windows, macOS, Ubuntu, Fedora, CentOS, Debian, and Archlinux. If your OS isn't listed but is similar to one of these (like a Debian-based or RedHat-based system), it might still work.

OS Family OS Version Status Idempotent Tested On

What does idempotent mean? Idempotent means that if you run this role twice, there will be no changes the second time.

We worked hard to refine our CI configurations and build tools. If you want to learn more about how we improved our process, check out our Ansible common files and Ansible documentation repositories. See the CONTRIBUTING.md guide for more details.

Dependencies

Most of our roles rely on collections from Ansible Galaxy. Some projects also depend on other roles and collections available on Ansible Galaxy. Before running this role, you need to install the required collections and role dependencies, as well as the Python requirements:

if type poetry &> /dev/null; then poetry install --no-root; else pip3 install -r .config/assets/requirements.txt; fi
ansible-galaxy install -r requirements.yml

Alternatively, if you're new to Ansible and don't mind installing development requirements, simply run bash .config/scripts/start.sh. This is an easy way to ensure everything works correctly.

Python

While Ansible (a Python package) is the only tool needed to run this play on a standard machine, several other Python dependencies are included for special use cases and development. The table below lists these packages:

Package Description Required
ansible A configuration management tool for remote computer configuration.
✔️
docker Enables provisioning Docker containers with Ansible.
✔️
python-vagrant Needed for provisioning Vagrant VMs.
✔️
pywinrm Needed for configuring Windows machines using WinRM.
✔️
ansible-lint A tool for checking the quality of Ansible files.
ansibler Tool used for generating advanced documentation.
black Auto-formatter for Python files, useful for projects that use Python test scripts.
blocklint Linting tool to prevent certain words in the code.
flake8 Python linter for checking syntax and style errors.
mod-ansible-autodoc A custom fork of ansible-autodoc for auto-generating documentation from comments in the role's YAML files.
molecule A testing framework for Ansible.
molecule-docker Molecule plugin for provisioning Docker containers.
molecule-vagrant Molecule plugin for provisioning Vagrant VMs.
pre-commit-hooks Useful tools for linting.
proselint A linter for improving English language documentation.
yamllint A linter for ensuring proper syntax and style in YAML files.

Galaxy Roles

While most of our roles do not have external dependencies, some may require another role to be installed first. At the beginning of the play, any needed Ansible Galaxy role dependencies listed in meta/main.yml will be automatically installed. If you have multiple roles with shared dependencies in your playbook, the installation will only happen once for efficiency. Some roles also include helper roles directly in the tasks for better modularity.

The requirements.yml file lists all the Ansible Galaxy dependencies needed for this role. Here's a brief overview of the role dependencies:

role_dependencies

Galaxy Collections

This role depends on multiple Ansible Galaxy collections. Below is a list of these collections and their sources:

  • community.general Ansible Galaxy badge
  • google.cloud Ansible Galaxy badge

Example Playbook

After installing the necessary dependencies, just add the role to your main playbook. The role will manage permissions, so you can add it without worrying about root-level commands:

- hosts: all
  roles:
    - professormanhattan.snapd

If you are adding this role to an existing playbook, it might be helpful to copy the necessary requirements from pyproject.toml and requirements.yml into your playbook’s root. This way, you only need to install one set of requirements in the future. You can also merge pyproject.toml into a more traditional requirements.txt file if you prefer that approach.

Real World Example

For a real-world example of a playbook that uses this role, check out our main playbook called Gas Station. It’s a great learning resource for using Ansible and incorporates well-designed build tools for advanced users. Even if you aren't focused on Ansible, it can help you create a powerful development environment on your computer and network. Overall, it’s a project worth exploring!

Contributing

We welcome contributions, questions, and feature requests! Feel free to visit the issues page. If you want to contribute, please refer to the contributing guide.

Sponsorship

Dear Awesome Person,

I create open-source projects because I love it. Although I have job and a home, being appreciated for my work would be wonderful. Please consider sponsoring me! Who knows? Maybe I could quit my job and dedicate my time to open source.

Sincerely,

Brian Zalewski

Open Collective sponsors GitHub sponsors Patreon

Affiliates

Here’s a list of services we use that offer special incentives for signing up through our links:

MailChimp DigitalOcean Referral Badge

License

Copyright © 2020-2021 Megabyte LLC. This project is licensed under MIT.

Installa
ansible-galaxy install professormanhattan.snapd
Licenza
other
Download
4.5k
Proprietario
Often imitated, never duplicated