-
Notifications
You must be signed in to change notification settings - Fork 162
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 copying custom manifests #265
Conversation
# Path to custom manifests deployed during the RKE2 installation | ||
# It is possible to use Jinja2 templating in the manifests | ||
# Path to folder with custom manifests deployed during the RKE2 installation | ||
# It is possible to use Jinja2 templating in the manifests, if the filename ends with .j2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be also yaml or yml.
ansible.builtin.template
will template file with any file extension. The .j2
is not mandatory. You may use just .yaml
and the file will be still templated if there is a Jinja2 syntax in it.
This option was meant to be used for files with yaml (or yml) files. But user could use Jinja2 syntax in it and it would be templated.
The actual bug here is that if the user will add .j2
file extension to the manifest file, the file will end up with .j2
also on the RKE2 server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, good point. Will fix.
# Path to custom manifests deployed during the RKE2 installation | ||
# It is possible to use Jinja2 templating in the manifests | ||
# Path to folder with custom manifests deployed during the RKE2 installation | ||
# It is possible to use Jinja2 templating in the manifests, if the filename ends with .j2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be also yaml or yml.
ansible.builtin.template
will template file with any file extension. The .j2
is not mandatory. You may use just .yaml
and the file will be still templated if there is a Jinja2 syntax in it.
This option was meant to be used for files with yaml (or yml) files. But user could use Jinja2 syntax in it and it would be templated.
The actual bug here is that if the user will add .j2
file extension to the manifest file, the file will end up with .j2
also on the RKE2 server.
@@ -193,8 +193,8 @@ rke2_disable_cloud_controller: false | |||
# applicable only if rke2_disable_cloud_controller is true | |||
rke2_cloud_provider_name: "external" | |||
|
|||
# Path to custom manifests deployed during the RKE2 installation | |||
# It is possible to use Jinja2 templating in the manifests | |||
# Path to folder with custom manifests deployed during the RKE2 installation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thin't it's better to keep it as a list of manifests. They can be in different folders or subfolders
@@ -155,8 +155,8 @@ rke2_disable_cloud_controller: false | |||
# applicable only if rke2_disable_cloud_controller is true | |||
rke2_cloud_provider_name: "external" | |||
|
|||
# Path to custom manifests deployed during the RKE2 installation | |||
# It is possible to use Jinja2 templating in the manifests | |||
# Path to folder with custom manifests deployed during the RKE2 installation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thin't it's better to keep it as a list of manifests. They can be in different folders or subfolders
mode: 0644 | ||
with_items: "{{ rke2_custom_manifests }}" | ||
mode: 0640 | ||
with_fileglob: "{{ rke2_custom_manifests }}/*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thin't it's better to keep it as a list of manifests. They can be in different folders or subfolders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I guess you could have {{ query('fileglob', rke2_custom_manifests + '/*') }}
as an example instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, i think this is outdated
ansible-role-rke2/tasks/rke2.yml
Lines 252 to 259 in 859a27f
- name: Copy Custom Manifests | |
ansible.builtin.template: | |
src: "{{ item }}" | |
dest: "{{ rke2_data_path }}/server/manifests/{{ item | basename | regex_replace('\\.j2$', '') }}" | |
owner: root | |
group: root | |
mode: 0644 | |
with_fileglob: "{{ rke2_custom_manifests }}/*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, i think this is outdated
ansible-role-rke2/tasks/rke2.yml
Lines 252 to 259 in 859a27f
- name: Copy Custom Manifests ansible.builtin.template: src: "{{ item }}" dest: "{{ rke2_data_path }}/server/manifests/{{ item | basename | regex_replace('\\.j2$', '') }}" owner: root group: root mode: 0644 with_fileglob: "{{ rke2_custom_manifests }}/*"
Yep - with the same code I wrote! So now it includes the glob functionality that @MonolithProjects said he didn't want to implement. Was that on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No @simonfelding, i overlooked it. Seems like you included the code in #260 . Will check it tomorrow as it is probably breaking the Custom Manifests (#285)
This was fixed in #290. Closing this PR. |
Description
Copying custom manifests didn't actually work with j2 templates.
Type of change
How Has This Been Tested?
executed the code and copied a file over