diff --git a/roles/containerd/tasks/main.yml b/roles/containerd/tasks/main.yml index 63f9301..de0a16d 100644 --- a/roles/containerd/tasks/main.yml +++ b/roles/containerd/tasks/main.yml @@ -6,24 +6,21 @@ - name: 准备containerd相关目录 file: name={{ item }} state=directory with_items: - - "{{ bin_dir }}" + - "{{ bin_dir }}/containerd-bin" - "/etc/containerd" - name: 加载内核模块 overlay modprobe: name=overlay state=present - name: 下载 containerd 二进制文件 - copy: src={{ base_dir }}/bin/containerd-bin/{{ item }} dest={{ bin_dir }}/{{ item }} mode=0755 - with_items: - - containerd - - containerd-shim - - containerd-shim-runc-v1 - - containerd-shim-runc-v2 - - crictl - - ctr - - runc + copy: src={{ item }} dest={{ bin_dir }}/containerd-bin/ mode=0755 + with_fileglob: + - {{ base_dir }}/bin/containerd-bin/* tags: upgrade + - name: 下载 crictl + copy: src={{ base_dir }}/bin/crictl dest={{ bin_dir }}/crictl mode=0755 + - name: 添加 crictl 自动补全 lineinfile: dest: ~/.bashrc diff --git a/roles/containerd/templates/containerd.service.j2 b/roles/containerd/templates/containerd.service.j2 index ec8a297..ec5c1e6 100644 --- a/roles/containerd/templates/containerd.service.j2 +++ b/roles/containerd/templates/containerd.service.j2 @@ -4,9 +4,9 @@ Documentation=https://containerd.io After=network.target [Service] -Environment="PATH={{ bin_dir }}:/bin:/sbin:/usr/bin:/usr/sbin" +Environment="PATH={{ bin_dir }}/containerd-bin:/bin:/sbin:/usr/bin:/usr/sbin" ExecStartPre=-/sbin/modprobe overlay -ExecStart={{ bin_dir }}/containerd +ExecStart={{ bin_dir }}/containerd-bin/containerd Restart=always RestartSec=5 Delegate=yes