ansible-role-k8s/tasks/rke2/main.yml

43 lines
1.2 KiB
YAML

---
# BOOTSTRAP
- name: rke2 boostrap initial server node
ansible.builtin.shell: "{{ k8s_install_script }}"
environment: "{{ k8s_env }}"
when:
- k8s_node_type == "bootstrap"
- name: rke2 cni custom template
ansible.builtin.template:
src: "templates/{{ k8s_type }}/cni/{{ k8s_cni_custom_template }}.j2"
dest: "{{ k8s_manifests_path }}/{{ k8s_type }}-{{ k8s_cni_custom_template }}"
mode: 0600
when:
- k8s_cni_custom_template is defined
- k8s_node_type == "bootstrap"
- name: rke2 start bootstrap node
ansible.builtin.include_tasks: shared/start.yml
when:
- k8s_node_type == "bootstrap"
# ADD SERVERS
- name: rke2 add additional server nodes
ansible.builtin.shell: "{{ k8s_install_script }}"
environment: "{{ k8s_env }}"
when:
- k8s_node_type == "server"
# ADD AGENTS
- name: rke2 add agent nodes
ansible.builtin.shell: "{{ k8s_install_script }}"
environment: "{{ k8s_env }}"
when:
- k8s_node_type == "agent"
# POST-DEPLOY
- name: rke2 start additional nodes
ansible.builtin.include_tasks: shared/start.yml
when:
- k8s_node_type != "bootstrap"