use basename of url for items in k3s_server_manifests_urls and k3s_server_pod_manifests_urls if filename is not provided

Signed-off-by: Karsten Kosmala <kosmala@cosmocode.de>
This commit is contained in:
Karsten Kosmala 2022-01-20 11:13:32 +01:00
parent 3be9eff967
commit 424145881c
2 changed files with 3 additions and 3 deletions

View file

@ -338,7 +338,7 @@ to `true`.
#### Important note about `k3s_server_manifests_urls` and `k3s_server_pod_manifests_urls`
To deploy server manifests and server pod manifests from URL, you need to
specify a `url` and a `filename`. Below is an example of how to deploy the
specify a `url` and optionally a `filename` (if none provided basename is used). Below is an example of how to deploy the
Tigera operator for Calico and kube-vip.
```yaml

View file

@ -34,7 +34,7 @@
- name: Ensure auto-deploying manifests are downloaded to the primary controller
ansible.builtin.get_url:
url: "{{ item.url }}"
dest: "{{ k3s_server_manifests_dir }}/{{ item.filename }}"
dest: "{{ k3s_server_manifests_dir }}/{{ item.filename | default(item.url | basename }}"
mode: 0644
loop: "{{ k3s_server_manifests_urls }}"
become: "{{ k3s_become }}"
@ -55,7 +55,7 @@
- name: Ensure auto-deploying manifests are downloaded to the primary controller
ansible.builtin.get_url:
url: "{{ item.url }}"
dest: "{{ k3s_server_pod_manifests_dir }}/{{ item.filename }}"
dest: "{{ k3s_server_pod_manifests_dir }}/{{ item.filename | default(item.url | basename }}"
mode: 0644
loop: "{{ k3s_server_pod_manifests_urls }}"
become: "{{ k3s_become }}"