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

43 lines
1.2 KiB
YAML
Raw Normal View History

2024-04-27 01:33:23 +00:00
---
# BOOTSTRAP
- name: rke2 boostrap initial server node
ansible.builtin.shell: "{{ k8s_install_script }}"
environment: "{{ k8s_env }}"
2024-04-27 01:33:23 +00:00
when:
- k8s_node_type == "bootstrap"
- name: rke2 template cni manifest override
2024-04-27 01:33:23 +00:00
ansible.builtin.template:
src: "templates/{{ k8s_type }}/{{ k8s_cni_type | d('canal') }}-config.yaml.j2"
dest: "{{ k8s_manifests_path }}/{{ k8s_type }}-{{ k8s_cni_type | d('canal') }}-config.yaml"
2024-04-27 01:33:23 +00:00
mode: 0600
when:
- k8s_cni_manifest_overrides is defined and k8s_cni_manifest_overrides
2024-04-27 01:33:23 +00:00
- k8s_node_type == "bootstrap"
- name: rke2 start bootstrap node
ansible.builtin.include_tasks: shared/start.yml
2024-04-27 01:33:23 +00:00
when:
- k8s_node_type == "bootstrap"
# ADD SERVERS
- name: rke2 add additional server nodes
ansible.builtin.shell: "{{ k8s_install_script }}"
environment: "{{ k8s_env }}"
2024-04-27 01:33:23 +00:00
when:
- k8s_node_type == "server"
# ADD AGENTS
- name: rke2 add agent nodes
ansible.builtin.shell: "{{ k8s_install_script }}"
environment: "{{ k8s_env }}"
2024-04-27 01:33:23 +00:00
when:
- k8s_node_type == "agent"
# POST-DEPLOY
- name: rke2 start additional nodes
ansible.builtin.include_tasks: shared/start.yml
2024-04-27 01:33:23 +00:00
when:
- k8s_node_type != "bootstrap"