163 lines
5.4 KiB
YAML
163 lines
5.4 KiB
YAML
- name: "prepare install k3s"
|
|
shell: sed -ie "s/SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
|
|
|
|
#- name: "execute k3s install"
|
|
# shell: curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn INSTALL_K3S_SKIP_ENABLE=true sh -
|
|
|
|
- name: "get k3s to dest"
|
|
get_url:
|
|
url: https://repo.geedge.net/filerepo/install/release/os-build-files/k3s/v1.29.2/k3s
|
|
dest: /usr/bin/k3s
|
|
url_username: "{{ lookup('env', 'PULP_REPO_USERNAME') }}"
|
|
url_password: "{{ lookup('env', 'PULP_REPO_PASSWORD') }}"
|
|
mode: 0755
|
|
|
|
|
|
- name: "Create /var/lib/rancher/k3s/agent/images directory"
|
|
file:
|
|
path: "/var/lib/rancher/k3s/agent/images"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
# - name: "copy k3s-airgap-images-amd64.tar to destination"
|
|
# copy:
|
|
# src: "{{ role_path }}/files/k3s-airgap-images-amd64.tar"
|
|
# dest: /var/lib/rancher/k3s/agent/images/
|
|
|
|
- name: "get k3s-airgap-images-amd64.tar to dest"
|
|
get_url:
|
|
url: https://repo.geedge.net/filerepo/install/release/os-build-files/k3s/v1.29.2/k3s-airgap-images-amd64.tar
|
|
dest: /var/lib/rancher/k3s/agent/images/k3s-airgap-images-amd64.tar
|
|
url_username: "{{ lookup('env', 'PULP_REPO_USERNAME') }}"
|
|
url_password: "{{ lookup('env', 'PULP_REPO_PASSWORD') }}"
|
|
|
|
- name: "execute k3s install"
|
|
shell: curl -sfL https://get.k3s.io | INSTALL_K3S_SKIP_DOWNLOAD=true INSTALL_K3S_SKIP_ENABLE=true INSTALL_K3S_BIN_DIR=/usr/bin INSTALL_K3S_SYSTEMD_DIR=/usr/lib/systemd/system sh -s - --flannel-backend=none --node-name=localhost --disable-helm-controller
|
|
|
|
- name: "enable k3s"
|
|
systemd:
|
|
name: k3s
|
|
enabled: yes
|
|
|
|
- name: "kubectl bash auto-completion"
|
|
shell: kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null
|
|
|
|
- name: "copy k3s resouce file to k3s manifests directory"
|
|
copy:
|
|
src: "{{ role_path }}/files/multus-daemonset.yml"
|
|
dest: /var/lib/rancher/k3s/server/manifests/
|
|
|
|
- name: "copy k3s fish completion file to host"
|
|
copy:
|
|
src: "{{ role_path }}/files/kubectl.fish"
|
|
dest: /usr/share/fish/completions/
|
|
|
|
- name: "copy k3s.service.env to destination"
|
|
copy:
|
|
src: "{{ role_path }}/files/k3s.service.env"
|
|
dest: /usr/lib/systemd/system/k3s.service.env
|
|
|
|
- name: "copy multus-cni.tar to destination"
|
|
copy:
|
|
src: "{{ role_path }}/files/multus-cni.tar"
|
|
dest: /var/lib/rancher/k3s/agent/images/
|
|
|
|
- name: "create cni bin directory"
|
|
file:
|
|
path: "/opt/cni/bin"
|
|
state: directory
|
|
|
|
- name: "unarchive cni plugin tar package"
|
|
unarchive:
|
|
src: "{{ role_path }}/files/cni-plugins-linux-amd64.tgz"
|
|
dest: /opt/cni/bin/
|
|
|
|
- name: "copy 10-bridge.conf to destination"
|
|
copy:
|
|
src: "{{ role_path }}/files/10-bridge.conf"
|
|
dest: /etc/cni/net.d/
|
|
|
|
- name: "copy config.yaml to dest for resource management"
|
|
copy:
|
|
src: "{{ role_path }}/files/config.yaml"
|
|
dest: /etc/rancher/k3s/
|
|
|
|
- name: "copy clean_orphaned_pods_dir to dest"
|
|
copy:
|
|
src: "{{ role_path }}/files/clean_orphaned_pods_dir.sh"
|
|
dest: /opt/tsg/k3s/scripts/
|
|
mode: 0755
|
|
|
|
- name: "copy override service file to dest"
|
|
copy:
|
|
src: "{{ role_path }}/files/service_set_RuntimeMaxSec.conf"
|
|
dest: /usr/lib/systemd/system/k3s.service.d/
|
|
|
|
- name: "Create /usr/libexec/k3s directory if it does not exist"
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: '0755'
|
|
with_items:
|
|
- /usr/libexec/k3s
|
|
|
|
|
|
- name: "copy k3s-orphaned-pods-dir-clean.service to destination"
|
|
copy:
|
|
src: "{{ role_path }}/files/k3s-orphaned-pods-dir-clean.service"
|
|
dest: /usr/lib/systemd/system/
|
|
|
|
- name: "copy k3s-orphaned-pods-dir-clean.timer to destination"
|
|
copy:
|
|
src: "{{ role_path }}/files/k3s-orphaned-pods-dir-clean.timer"
|
|
dest: /usr/lib/systemd/system/
|
|
|
|
- name: "enable k3s-orphaned-pods-dir-clean.timer"
|
|
systemd:
|
|
name: k3s-orphaned-pods-dir-clean.timer
|
|
enabled: yes
|
|
|
|
- name: "copy nic-uio-binder file to dest"
|
|
copy:
|
|
src: "{{ role_path }}/files/nic-uio-binder.yaml"
|
|
dest: /var/lib/rancher/k3s/server/manifests/
|
|
|
|
- name: "copy log-collector file to dest"
|
|
copy:
|
|
src: "{{ role_path }}/files/log-collector.yaml"
|
|
dest: /var/lib/rancher/k3s/server/manifests/
|
|
|
|
- name: "copy dynamic-hostport yaml file to k3s manifests directory"
|
|
copy:
|
|
src: "{{ role_path }}/files/dynamic-hostport.yaml"
|
|
dest: /var/lib/rancher/k3s/server/manifests/
|
|
|
|
- name: "Get dynamic-hostport chart images to dest"
|
|
get_url:
|
|
url: https://repo.geedge.net/filerepo/install/release/tsg-container-images/dynamic-hostport.tar
|
|
dest: /var/lib/rancher/k3s/agent/images/dynamic-hostport.tar
|
|
url_username: "{{ lookup('env', 'PULP_REPO_USERNAME') }}"
|
|
url_password: "{{ lookup('env', 'PULP_REPO_PASSWORD') }}"
|
|
|
|
- name: "copy coredns-custom yaml file to k3s manifests directory"
|
|
copy:
|
|
src: "{{ role_path }}/files/coredns-custom.yaml"
|
|
dest: /var/lib/rancher/k3s/server/manifests/
|
|
|
|
- name: "copy k3s-reset.sh to /usr/bin"
|
|
copy:
|
|
src: "{{ role_path }}/files/k3s-reset.sh"
|
|
dest: /usr/bin/
|
|
mode: 0755
|
|
|
|
- name: "download helm-controller images tar"
|
|
get_url:
|
|
url: https://repo.geedge.net/filerepo/install/release/os-build-files/k3s/v1.29.2/k3s-helm-controller-amd64.tar
|
|
dest: /var/lib/rancher/k3s/agent/images/k3s-helm-controller-amd64.tar
|
|
url_username: "{{ lookup('env', 'PULP_REPO_USERNAME') }}"
|
|
url_password: "{{ lookup('env', 'PULP_REPO_PASSWORD') }}"
|
|
|
|
- name: "install deploy helm-controller mainfest file to dest"
|
|
copy:
|
|
src: "{{ role_path }}/files/deploy-helm-controller.yaml"
|
|
dest: /var/lib/rancher/k3s/server/manifests/ |