2021-06-22 21:47:58 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Ensure that the manifests directory exists
|
|
|
|
ansible.builtin.file:
|
|
|
|
state: directory
|
|
|
|
path: "{{ k3s_server_manifests_dir }}"
|
|
|
|
mode: 0755
|
|
|
|
when: >-
|
|
|
|
k3s_server_manifests_templates | length > 0
|
|
|
|
or k3s_server_manifests_urls | length > 0
|
2022-01-02 22:52:09 +01:00
|
|
|
become: "{{ k3s_become }}"
|
2021-06-22 21:47:58 +02:00
|
|
|
|
|
|
|
- name: Ensure that the pod-manifests directory exists
|
|
|
|
ansible.builtin.file:
|
|
|
|
state: directory
|
|
|
|
path: "{{ k3s_server_pod_manifests_dir }}"
|
|
|
|
mode: 0755
|
|
|
|
when: >-
|
|
|
|
k3s_server_pod_manifests_templates | length > 0
|
|
|
|
or k3s_server_pod_manifests_urls | length > 0
|
2022-01-02 22:52:09 +01:00
|
|
|
become: "{{ k3s_become }}"
|
2021-06-22 21:47:58 +02:00
|
|
|
|
|
|
|
# https://rancher.com/docs/k3s/latest/en/advanced/#auto-deploying-manifests
|
|
|
|
- name: Ensure auto-deploying manifests are copied to the primary controller
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "{{ k3s_server_manifests_dir }}/{{ item | basename | replace('.j2','') }}"
|
|
|
|
mode: 0644
|
|
|
|
loop: "{{ k3s_server_manifests_templates }}"
|
2022-01-02 22:52:09 +01:00
|
|
|
become: "{{ k3s_become }}"
|
2021-06-22 21:47:58 +02:00
|
|
|
when:
|
|
|
|
- k3s_server_manifests_templates | length > 0
|
|
|
|
|
|
|
|
- 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 }}"
|
|
|
|
mode: 0644
|
|
|
|
loop: "{{ k3s_server_manifests_urls }}"
|
2022-01-02 22:52:09 +01:00
|
|
|
become: "{{ k3s_become }}"
|
2021-06-22 21:47:58 +02:00
|
|
|
when:
|
|
|
|
- not ansible_check_mode
|
|
|
|
- k3s_server_manifests_urls | length > 0
|
|
|
|
|
|
|
|
# https://github.com/k3s-io/k3s/pull/1691
|
|
|
|
- name: Ensure static pod manifests are copied to controllers
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: "{{ item }}"
|
|
|
|
dest: "{{ k3s_server_pod_manifests_dir }}/{{ item | basename | replace('.j2','') }}"
|
|
|
|
mode: 0644
|
|
|
|
loop: "{{ k3s_server_pod_manifests_templates }}"
|
2022-01-02 22:52:09 +01:00
|
|
|
become: "{{ k3s_become }}"
|
2021-06-22 21:47:58 +02:00
|
|
|
|
|
|
|
# https://rancher.com/docs/k3s/latest/en/advanced/#auto-deploying-manifests
|
|
|
|
- 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 }}"
|
|
|
|
mode: 0644
|
|
|
|
loop: "{{ k3s_server_pod_manifests_urls }}"
|
2022-01-02 22:52:09 +01:00
|
|
|
become: "{{ k3s_become }}"
|
2021-06-22 21:47:58 +02:00
|
|
|
when: not ansible_check_mode
|