Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: yaml conditional logic #273

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

danihodovic
Copy link
Contributor

@danihodovic danihodovic commented Dec 8, 2023

Running the playbook with version 2.16.1 I get a templating error in the conditional checks. I don't think '&&' can be used a logical AND.

Linked Issues

#276

TASK [k3s_server : Merge with any existing kube config] *********************************************************************************************************************
fatal: [78.47.92.188 -> 127.0.0.1]: FAILED! => {"msg": "The conditional check 'kubeconfig == \"~/.kube/config.new\" && kubectl_installed.rc == 0' failed. The error was: template error while templating string: unexpected char '&' at 41. String: {% if kubeconfig == \"~/.kube/config.new\" && kubectl_installed.rc == 0 %} True {% else %} False {% endif %}. unexpected char '&' at 41\n\nThe error appears to be in '/home/dani/repos/my-cluster/k3s-ansible/roles/k3s_server/tasks/main.yml': line 128, 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: Merge with any existing kube config\n      ^ here\n"}

Running the playbook with version 2.16.1 I get a templating error in the
conditional checks. I don't think '&&' can be used a logical AND.

```
TASK [k3s_server : Merge with any existing kube config] *********************************************************************************************************************
fatal: [78.47.92.188 -> 127.0.0.1]: FAILED! => {"msg": "The conditional check 'kubeconfig == \"~/.kube/config.new\" && kubectl_installed.rc == 0' failed. The error was: template error while templating string: unexpected char '&' at 41. String: {% if kubeconfig == \"~/.kube/config.new\" && kubectl_installed.rc == 0 %} True {% else %} False {% endif %}. unexpected char '&' at 41\n\nThe error appears to be in '/home/dani/repos/my-cluster/k3s-ansible/roles/k3s_server/tasks/main.yml': line 128, 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: Merge with any existing kube config\n      ^ here\n"}
```

Signed-off-by: Dani Hodovic <[email protected]>
@dereknola dereknola merged commit fdaba90 into k3s-io:master Dec 11, 2023
2 checks passed
@danihodovic danihodovic deleted the fix-conditional-checks branch December 12, 2023 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants