uniontech-kongzi.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. ---
  2. - name: Add cloud rpm repository
  3. shell: |
  4. cat > /etc/yum.repos.d/yunion.repo <<-'EOF'
  5. [yunion-repo-uos-kongzi]
  6. name=Packages for Yunion Multi-Cloud Platform -
  7. baseurl=https://iso.yunion.cn/centos/7/3.10/{{ansible_architecture}}
  8. sslverify=0
  9. enabled=1
  10. gpgcheck=0
  11. EOF
  12. become: yes
  13. when:
  14. - is_uos_kongzi is defined
  15. - name: Check containerd status
  16. command: systemctl is-active containerd
  17. register: containerd_status
  18. failed_when: false
  19. - name: Take action if containerd stopped
  20. block:
  21. - name: get containerd
  22. get_url:
  23. url: "https://iso.yunion.cn/uos/kongzi/3.10/{{ ansible_architecture}}/containerd-1.7.2-linux.tar.gz"
  24. dest: /tmp/containerd-1.7.2-linux.tar.gz
  25. force: yes
  26. validate_certs: no
  27. - name: install containerd
  28. shell: |
  29. mkdir -p /usr/local/containerd
  30. tar xzvf /tmp/containerd-1.7.2-linux.tar.gz -C /usr/local/containerd
  31. for i in /usr/local/containerd/bin/*
  32. do
  33. ln -sf $i /usr/bin/
  34. done
  35. cat > /usr/lib/systemd/system/containerd.service <<-EOF
  36. [Unit]
  37. Description=containerd container runtime
  38. Documentation=https://containerd.io
  39. After=network.target local-fs.target
  40. [Service]
  41. ExecStartPre=-/sbin/modprobe overlay
  42. ExecStart=/usr/bin/containerd
  43. Type=notify
  44. Delegate=yes
  45. KillMode=process
  46. Restart=always
  47. RestartSec=5
  48. # Having non-zero Limit*s causes performance problems due to accounting overhead
  49. # in the kernel. We recommend using cgroups to do container-local accounting.
  50. LimitNPROC=infinity
  51. LimitCORE=infinity
  52. LimitNOFILE=infinity
  53. # Comment TasksMax if your systemd version does not supports it.
  54. # Only systemd 226 and above support this version.
  55. TasksMax=infinity
  56. OOMScoreAdjust=-999
  57. [Install]
  58. WantedBy=multi-user.target
  59. EOF
  60. systemctl daemon-reload
  61. systemctl enable --now containerd
  62. systemctl is-active containerd
  63. args:
  64. executable: /bin/bash
  65. become: yes
  66. when:
  67. - containerd_status.stdout != "active"
  68. - name: Include RedHat Family Common Tasks
  69. include_tasks: redhat.yml