Skip to content

Commit

Permalink
Merge pull request #20 from mila-iqia/fix/cleanup_snippets
Browse files Browse the repository at this point in the history
fix: Do not search existing snippets by name
  • Loading branch information
btravouillon authored May 31, 2023
2 parents 1c0ffbe + 87e70fb commit c6b7d0f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tasks/snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@

- name: "Find existing snippets {{ _snippet_type }}"
ansible.builtin.find:
paths: "/var/lib/cobbler/snippets/{{ _snippet_type }}/{{ item.1.name }}/"
paths: "/var/lib/cobbler/snippets/{{ _snippet_type }}/"
file_type: file
loop: "{{ _snippet_conf }}"
loop_control:
label: "List snippets in /var/lib/cobbler/snippets/{{ _snippet_type }}/{{ item.1.name }}/"
recurse: true
register: _find_snippets

- name: "Define list of existing snippets {{ _snippet_type }}"
ansible.builtin.set_fact:
_existing_snippets: "{{ _find_snippets | community.general.json_query('results[*].files[*].path') | flatten | unique }}"
_existing_snippets: "{{ _find_snippets | community.general.json_query('files[*].path') | flatten | unique }}"

- name: "Remove unmanaged snippets {{ _snippet_type }}"
ansible.builtin.file:
Expand Down

0 comments on commit c6b7d0f

Please sign in to comment.