Skip to content

githubixx/ansible-role-cni

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansible-role-cni

Ansible role to install CNI - Container Network Interface. CNI (Container Network Interface), a Cloud Native Computing Foundation project, consists of a specification and libraries for writing plugins to configure network interfaces in Linux containers, along with a number of supported plugins. CNI concerns itself only with network connectivity of containers and removing allocated resources when the container is deleted. Because of this focus, CNI has a wide range of support and the specification is simple to implement.

Changelog

Change history:

See full CHANGELOG

Recent changes:

0.12.0+1.9.0

  • UPDATE
    • update cni_version to 1.9.0

0.11.0+1.8.0

  • Breaking

    • meta/main.yml: Change min_ansible_version to 2.15. Ansible 2.9 is end-of-life (EOL).
  • UPDATE

    • update cni_version to 1.8.0
    • update .gitignore

0.10.0+1.7.1

  • UPDATE

    • update cni_version to 1.7.1
  • MOLECULE

    • Use generic/arch Vagrant box instead of archlinux/archlinux (no longer available)
    • Install openssl package for Archlinux
    • Removed Ubuntu 20.04 because reached end of life
    • Removed 'Upgrade the whole system' task

0.9.1+1.6.2

  • update cni_version to 1.6.2

Role Variables

# CNI plugin version
cni_version: "1.8.0"

# CNI binary directory
cni_bin_directory: "/opt/cni/bin"

# CNI configuration directory
cni_conf_directory: "/etc/cni/net.d"

# Directory to store the archive
cni_tmp_directory: "{{ lookup('env', 'TMPDIR') | default('/tmp', true) }}"

# Owner/group of "CNI" files/directories. If the variables are not set
# the resulting binary will be owned by the current user.
cni_owner: "root"
cni_group: "root"

# Specifies the permissions of the "CNI" binaries
cni_binary_mode: "0755"

# Operating system
# Possible options: "linux", "windows"
cni_os: "linux"

# Processor architecture "CNI" should run on.
# Other possible values: "arm", "arm64", "mips64le", "ppc64le", "s390x"
cni_arch: "amd64"

# Name of the archive file name
cni_archive: "cni-plugins-{{ cni_os }}-{{ cni_arch }}-v{{ cni_version }}.tgz"

# The CNI download URL (normally no need to change it)
cni_url: "https://github.com/containernetworking/plugins/releases/download/v{{ cni_version }}/{{ cni_archive }}"

# Restart "kubelet" service after "CNI" binaries or configuration have changed.
# This handler expects a systemd service called "kubelet.service".
cni_restart_kubelet: false

TODO

  • Distribute CNI network configuration files (for Cilium this is not needed as CNI files are created by Cilium)

Example Playbook

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

Testing

This role has a small test setup that is created using Molecule, libvirt (vagrant-libvirt) and QEMU/KVM. Please see my blog post Testing Ansible roles with Molecule, libvirt (vagrant-libvirt) and QEMU/KVM how to setup. The test configuration is here.

Afterwards molecule can be executed:

molecule converge

This will setup a few virtual machines (VM) with different supported Linux operating systems and installs CNI.

To run a few tests:

molecule verify

To clean up run

molecule destroy

License

GNU GENERAL PUBLIC LICENSE Version 3

Author Information

http://www.tauceti.blog

About

Ansible role to install CNI (Container Network Interface)

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors