- name: Install K3s agent command: /root/k3s_install.sh {{ type }} environment: INSTALL_K3S_VERSION: "{{ kubernetes.version }}" when: k3s_installed.rc != 0 or (kubernetes.version != '' and ('k3s version ' ~ kubernetes.version ~ ' ') not in k3s_installed.stdout) register: command changed_when: "'No change detected' not in command.stdout" until: "command is not failed" retries: 2 delay: 10 - name: Make sure service is started / restarted on config change service: name: k3s-agent state: "{{ 'restarted' if not command.changed and config.changed else 'started' }}"