- name: stat if is rke2 installed stat: path: /usr/bin/rke2 register: rke2_installed - block: - include_tasks: setup_host.yml - include_tasks: install_rke2.yml when: ( not rke2_installed.stat.exists and state != 'absent' ) or (upgrade and state != 'absent' ) - include_tasks: templates.yml when: "state != 'absent' and 'master' in group_names " - block: - include_tasks: registries.yml - include_tasks: config_rke2.yml when: state != 'absent' - include_tasks: kubeconfig.yml when: state != 'absent' #and 'master' in group_names - name: uninstall rke2 command: rke2-uninstall.sh when: rke2_installed.stat.exists and state == 'absent' - include_tasks: rotate_encryption.yml when: state != 'absent' and 'control-plane' in group_names and rotate