new-cluster/alpine-cluster/roles/k3s-cluster-installer/tasks/control_plane.yaml

23 lines
865 B
YAML

- name: Install the rest of the control plane
block:
- name: Get the token
set_fact:
token: "{{ lookup('file',playbook_dir + '/config/token') }}"
- name: Get the primary ip
set_fact:
primary_ip: "{{ lookup('file',playbook_dir + '/config/primary_ip') }}"
- name: Run the installer
shell:
cmd: "curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC='server --server https://{{ primary_ip }}:6443 --tls-san {{ cp_fqdn }} --write-kubeconfig-mode 644 --token {{ token }}' sh -"
args:
creates: /etc/rancher/k3s/k3s.yaml
register: installed_cp
throttle: 1
- name: Pause to let the rest of the control plane to come up
wait_for:
timeout: 30
become: false
delegate_to: localhost
when: installed_cp.changed
become: true
when: "'control_plane' in group_names"