From 4e0e8c271afd7b45e4cacdaa7a639e0ec977db5b Mon Sep 17 00:00:00 2001 From: Thomas Kleinendorst Date: Fri, 4 Oct 2024 16:50:35 +0200 Subject: [PATCH] Fix podman container role on empty volumes Still some improvments could be made, such as handling the variable not being present. --- roles/podman-container/tasks/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/podman-container/tasks/main.yml b/roles/podman-container/tasks/main.yml index 84feb00..df77d2d 100644 --- a/roles/podman-container/tasks/main.yml +++ b/roles/podman-container/tasks/main.yml @@ -54,12 +54,13 @@ notify: Reload systemd (daemon-reload) - name: Flush handlers ansible.builtin.meta: flush_handlers + - name: Define empty volume array + ansible.builtin.set_fact: + volumes: [] - name: Map volumes to Podman accepted list ansible.builtin.set_fact: volumes: "{{ volumes + ['/home/' + container_user + '/' + item.name + ':' + item.mnt] }}" with_items: "{{ podman_container_volumes }}" - vars: - volumes: [] - name: Start the container containers.podman.podman_container: name: "{{ podman_container_name }}"