From 91d456ccad8502b8cd6c6431946435429e1ceed7 Mon Sep 17 00:00:00 2001 From: AnJia Date: Fri, 30 Apr 2021 14:31:33 +0800 Subject: [PATCH] fixed kubectl_get_nodes_result.stdout error os ubuntu amd64 16.04 LTS ansible 2.9.20 python version 2.7 ``` FAILED! => {"msg": "The conditional check 'item in kubectl_get_nodes_result.stdout' failed. The error was: error while evaluating conditional (item in kubectl_get_nodes_result.stdout): 'dict object' has no attribute 'stdout'\n\nThe error appears to be in '/home/rancher/.ansible/roles/xanmanning.k3s/tasks/teardown/drain-and-remove-nodes.yml': line 39, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Ensure uninstalled nodes are removed\n ^ here\n"} ``` --- tasks/teardown/drain-and-remove-nodes.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tasks/teardown/drain-and-remove-nodes.yml b/tasks/teardown/drain-and-remove-nodes.yml index 1f05e3a..8657e5a 100644 --- a/tasks/teardown/drain-and-remove-nodes.yml +++ b/tasks/teardown/drain-and-remove-nodes.yml @@ -29,6 +29,7 @@ delegate_to: "{{ k3s_control_delegate }}" run_once: true when: + - kubectl_get_nodes_result.stdout is defined - item in kubectl_get_nodes_result.stdout - hostvars[item].k3s_state is defined - hostvars[item].k3s_state == 'uninstalled' @@ -41,6 +42,7 @@ delegate_to: "{{ k3s_control_delegate }}" run_once: true when: + - kubectl_get_nodes_result.stdout is defined - item in kubectl_get_nodes_result.stdout - hostvars[item].k3s_state is defined - hostvars[item].k3s_state == 'uninstalled'