-
Notifications
You must be signed in to change notification settings - Fork 168
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
feature: Validate config before restarting rke2 #188
Comments
@MonolithProjects Would you accept an PR that installs |
Hi, |
In this case yamllint will catch the issue: $ yamllint /etc/rancher/rke2/config.yaml -d relaxed
/etc/rancher/rke2/config.yaml
1:1 warning too many blank lines (1 > 0) (empty-lines)
16:1 error syntax error: could not find expected ':' (syntax) (Warning can be ignored) |
But you wrote that your problem was caused by rke2_server_options:
service-node-port-range: 20000-32767 I thought you are talking about some kind of port conflict because of you changed the ports range. And of course this can not cause yaml syntax issue. What was the problem in the line no.16 ? |
The following yaml in Ansible causes an invalid yaml file on the server: # On Ansible controller
rke2_server_options:
service-node-port-range: 20000-32767 # On rke2 server
$ sudo grep service-node-port-range /etc/rancher/rke2/config.yaml
service-node-port-range:
# Invalid yaml here. Causes 'syntax error: could not find expected ':' (syntax)' Correct is: # On Ansible controller
rke2_server_options:
- "service-node-port-range: '20000-32767'" # On rke2 server
$ sudo grep service-node-port-range /etc/rancher/rke2/config.yaml
service-node-port-range: '20000-32767' # Valid yaml here |
Ah OK got it now. |
Indeed, that's better than using yamllint on the final config. Maybe use Role argument validation instead of adding a task. |
Summary
I had the following invalid ansible-role-rke2 config which lead to a broken
/etc/rancher/rke2/config.yaml
on the server:Maybe the
config.yaml
can be validated before trying to restart any service?Issue Type
Feature Idea
The text was updated successfully, but these errors were encountered: