ansible-role-k3s/tasks/ensure_k3s_config_files.yml

32 lines
1002 B
YAML
Raw Normal View History

2021-09-06 14:46:49 +02:00
---
- name: Ensure that the config.yaml.d directory exists
ansible.builtin.file:
state: directory
path: "{{ k3s_config_yaml_d_dir }}"
mode: 0755
2021-06-22 21:47:58 +02:00
when: >-
k3s_server_config_yaml_d_files | length > 0
or k3s_agent_config_yaml_d_files | length > 0
become: "{{ k3s_become }}"
2021-09-06 14:46:49 +02:00
2021-09-06 14:54:33 +02:00
# https://github.com/k3s-io/k3s/pull/3162
2021-09-06 14:46:49 +02:00
- name: Ensure configuration files are copied to controllers
ansible.builtin.template:
src: "{{ item }}"
2022-09-01 21:39:17 +02:00
dest: "{{ k3s_config_yaml_d_dir }}/{{ item | basename | replace('.j2', '') }}"
2021-09-06 14:46:49 +02:00
mode: 0644
loop: "{{ k3s_server_config_yaml_d_files }}"
become: "{{ k3s_become }}"
2021-06-22 21:47:58 +02:00
when: k3s_control_node
# https://github.com/k3s-io/k3s/pull/3162
- name: Ensure configuration files are copied to agents
ansible.builtin.template:
src: "{{ item }}"
2022-09-01 21:39:17 +02:00
dest: "{{ k3s_config_yaml_d_dir }}/{{ item | basename | replace('.j2', '') }}"
2021-06-22 21:47:58 +02:00
mode: 0644
loop: "{{ k3s_agent_config_yaml_d_files }}"
become: "{{ k3s_become }}"
2021-06-22 21:47:58 +02:00
when: not k3s_control_node