--- - name: Create volume mount directories become: true file: path: "{{ item.src }}" state: "{{ item.type }}" owner: dokku group: dokku with_items: "{{ config.volumes }}" when: - config.volumes - item.create | default(false) - name: Attach volume mounts dokku_storage: app: "{{ dokku.app }}" mounts: "{{ item.src }}:{{ item.dest }}{{ ':' + item.mode | default('') }}" with_items: "{{ config.volumes }}" when: config.volumes