githubixx.containerd

ansible-role-containerd

This is an Ansible role to install containerd. containerd is a widely used tool for running containers, focusing on being simple, reliable, and portable. It runs as a service on Linux and Windows, managing everything related to containers, including image storage, running containers, and handling networking.

Changelog

Change history:

For the complete change log, see the CHANGELOG.

Recent updates:

0.13.1+1.7.20

  • UPDATE
    • Updated containerd to v1.7.20.

0.13.0+1.7.19

  • FEATURE

    • Added support for Ubuntu 24.04.
  • UPDATE

    • Updated containerd to v1.7.19.

Installation

You can install this role in a few ways:

  • Clone from Github (make sure you're in the Ansible role directory):

    git clone https://github.com/githubixx/ansible-role-containerd.git githubixx.containerd
    
  • Use the ansible-galaxy command to install directly from Ansible Galaxy:

    ansible-galaxy install role githubixx.containerd
    
  • Create a requirements.yml file with these contents (this downloads the role from Github) and install it using:

    ansible-galaxy role install -r requirements.yml
    
    ---
    roles:
      - name: githubixx.containerd
        src: https://github.com/githubixx/ansible-role-containerd.git
        version: 0.13.1+1.7.20
    

Role Variables

You can customize the following variables in your setup:

# Only "base" is supported
containerd_flavor: "base"

# Version of containerd to install
containerd_version: "1.7.19"

# Directory for containerd binaries
containerd_binary_directory: "/usr/local/bin"

# Directory for the containerd configuration file
containerd_config_directory: "/etc/containerd"

# Directory for temporary files
containerd_tmp_directory: "{{ lookup('env', 'TMPDIR') | default('/tmp', true) }}"

# Owner and group of containerd binaries. Defaults to current user if not set
containerd_owner: "root"
containerd_group: "root"

# Permissions for the containerd binaries
containerd_binary_mode: "0755"

# Operating system (options: "linux", "windows")
containerd_os: "linux"

# Processor architecture for containerd
containerd_arch: "amd64"

# Name of the archive file
containerd_archive_base: "containerd-{{ containerd_version }}-{{ containerd_os }}-{{ containerd_arch }}.tar.gz"

# URL for downloading containerd
containerd_url: "https://github.com/containerd/containerd/releases/download/v{{ containerd_version }}/{{ containerd_archive_base }}"

# Settings for containerd systemd service
containerd_service_settings:
  "ExecStartPre": "{{ modprobe_location }} overlay"
  "ExecStart": "{{ containerd_binary_directory }}/containerd"
  "Restart": "always"
  "RestartSec": "5"
  "Type": "notify"
  "Delegate": "yes"
  "KillMode": "process"
  "OOMScoreAdjust": "-999"
  "LimitNOFILE": "1048576"
  "LimitNPROC": "infinity"
  "LimitCORE": "infinity"

# Configuration content for containerd
containerd_config: |
  version = 2
  [plugins]
    [plugins."io.containerd.grpc.v1.cri"]
      sandbox_image = "registry.k8s.io/pause:3.8"
      ...

Dependencies

Optional dependencies (useful for Kubernetes):

You can also use any other runc and CNI roles.

Example Playbook

Here's a simple example of how to use this role:

- hosts: your-host
  roles:
    - githubixx.containerd

More examples are available in the Molecule tests.

Testing

This role includes a basic testing setup using Molecule, libvirt (vagrant-libvirt), and QEMU/KVM. For setup instructions, see my blog post Testing Ansible roles with Molecule.

To run tests, execute:

molecule converge

This sets up a few virtual machines (VMs) for testing on different Linux systems, and installs containerd, runc, and the necessary CNI plugins.

After installation, you can verify with:

molecule verify

To remove VMs, use:

molecule destroy

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE Version 3.

Author Information

For more information, visit http://www.tauceti.blog.

Informazioni sul progetto

Ansible role to install containerd

Installa
ansible-galaxy install githubixx.containerd
Licenza
Unknown
Download
2.3k
Proprietario
Senior System Engineer - Python, Go, Cloud, Kubernetes, Commodore, Retro, 80's ;-)