ansible-playbook 安装nerdctl,方便后续重复安装
nerdctl.yaml
---
- hosts: 192.168.122.141
become: yes
tasks:
- name: Install required packages
apt:
name:
- tar
- wget
state: present
when: ansible_os_family == "Debian"
- name: Install required packages
yum:
name:
- tar
- wget
state: present
when: ansible_os_family == "RedHat"
- name: Download nerdctl
get_url:
url: "https://github.com/containerd/nerdctl/releases/download/v1.6.2/nerdctl-full-1.6.2-linux-amd64.tar.gz"
dest: "/tmp/nerdctl-full-1.6.2-linux-amd64.tar.gz"
mode: '0644'
- name: Extract nerdctl
unarchive:
src: "/tmp/nerdctl-full-1.6.2-linux-amd64.tar.gz"
dest: "/usr/local/"
remote_src: yes
- name: Copy systemd service files for buildkit and containerd
command:
cmd: "cp /usr/local/lib/systemd/system/{{ item }}.service /etc/systemd/system/"
loop:
- buildkit
- containerd
- stargz-snapshotter
- name: Enable and start buildkit and containerd services
systemd:
name: "{{ item }}"
enabled: yes
state: started
loop:
- buildkit
- containerd
标签:systemd,name,tar,containerd,nerdctl,ansible,安装
From: https://blog.51cto.com/first01/8096106