Files
ansible/playbooks/72_register_k3s_worker.yml
ladislav.dusa afc7817a81 conf added
2024-12-11 16:33:42 +01:00

21 lines
695 B
YAML
Executable File

- hosts: odroid_worker
name: Another task
become: true
tasks:
- name: Print token
ansible.builtin.debug:
msg: "[Master] K3S_TOKEN_HOLDER K3S token is {{ hostvars['K3S_TOKEN_HOLDER']['token'] }}"
- name: Print token
ansible.builtin.debug:
msg: "{{ hostvars['K3S_TOKEN_HOLDER']['token'] }}"
- name: Reconfigure K3S Worker
ansible.builtin.lineinfile:
path: /etc/systemd/system/k3s-agent.service.env
regexp: '^K3S_TOKEN='
line: K3S_TOKEN=\'{{ hostvars['K3S_TOKEN_HOLDER']['token'] }}\'
changed_when: false
- name: Restart K3S Worker
ansible.builtin.service:
name: k3s-agent
state: restarted