--- - name: Validate inputs ansible.builtin.import_tasks: validation.yaml - name: Create image for container {{ container_name }} ansible.builtin.include_role: name: image vars: image_name: "{{ container_image }}" when: image_created_images is not defined or container_image not in image_created_images - name: Create networks for container {{ container_name }} ansible.builtin.include_role: name: network vars: network_name: "{{ network }}" network_subnet: "{{ _container_network_subnet if network_index == 0 else '' }}" network_range: "{{ _container_network_range if network_index == 0 else '' }}" when: network_created_networks is not defined or network not in network_created_networks loop: "{{ container_networks }}" loop_control: loop_var: network index_var: network_index - name: Create volumes for container {{ container_name }} ansible.builtin.include_role: name: volume vars: volume_name: "{{ volume.source }}" volume_uid: "{{ volume.user | default('') }}" volume_gid: "{{ volume.group | default('') }}" volume_type: "{{ volume.volume_type | default('') }}" volume_device: "{{ volume.volume_device | default('') }}" volume_mount_options: "{{ volume.volume_mount_options | default([]) }}" loop: "{{ _container_volumes }}" loop_control: loop_var: volume - name: Create secrets ansible.builtin.include_tasks: secrets.yaml when: container_secrets | length > 0 - name: Create container {{ container_name }} containers.podman.podman_container: image: "{{ _container_image }}" name: "{{ container_name }}" command: "{{ container_command or omit }}" entrypoint: "{{ container_entrypoint or omit }}" user: "{{ container_user or omit }}" mount: "{{ _container_mounts | map('items') | map('map', 'join', '=') | map('join', ',') }}" network: "{{ _container_networks_with_ip }}" publish: "{{ container_publish_ports }}" secrets: "{{ _container_secrets }}" env: "{{ container_env }}" label: "{{ _container_labels if _container_labels | length > 0 else omit }}" state: quadlet quadlet_file_mode: "0600" quadlet_options: "{{ _container_quadlet_options }}" notify: Restart container service {{ container_name }}