Skip to content

Commit

Permalink
fix: remove duplication and fileglob
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Muransky committed Dec 18, 2024
1 parent 859a27f commit b8fe25e
Showing 1 changed file with 9 additions and 28 deletions.
37 changes: 9 additions & 28 deletions tasks/rke2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,34 +241,15 @@
with_items: "{{ rke2_custom_manifests }}"
when: rke2_custom_manifests

- name: Create /server/manifests directory
when: rke2_custom_manifests or rke2_static_pods
block:
- name: Create directory
ansible.builtin.file:
path: "{{ rke2_data_path }}/server/manifests"
state: directory
mode: 0755
- 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 }}/*"
when:
- rke2_custom_manifests
- inventory_hostname == groups[rke2_servers_group_name].0
- name: Copy Static Pods
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ rke2_data_path }}/agent/pod-manifests/{{ item | basename | regex_replace('\\.j2$', '') }}"
owner: root
group: root
mode: 0644
with_fileglob: "{{ rke2_static_pods }}/*"
when: rke2_static_pods
- name: Copy Static Pods
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ rke2_data_path }}/agent/pod-manifests/"
owner: root
group: root
mode: 0644
with_items: "{{ rke2_static_pods }}"
when: rke2_static_pods

- name: Copy RKE2 environment file
ansible.builtin.template:
Expand Down

0 comments on commit b8fe25e

Please sign in to comment.