--- /dev/null
+extends: default
+
+rules:
+  braces:
+    max-spaces-inside: 1
+    level: error
+  brackets:
+    max-spaces-inside: 1
+    level: error
+  line-length: disable
+#  truthy: disable
 
 ---
-resources_on_nfs: no
+resources_on_nfs: false
 
--- /dev/null
+---
+app_data_path: /opt/myleculeapp
+aux_data_path: "{{ app_data_path }}/runtime_images_source_dir"
+resources_dir: /data
+resources_filename: resources_package.tar
+aux_resources_filename: aux_resources_package.tar
+ansible_ssh_private_key_file: ~/.ssh/offline_ssh_key
 
--- /dev/null
+---
+dependency:
+  name: galaxy
+driver:
+  name: docker
+lint:
+  name: yamllint
+platforms:
+
+  - name: resource-host
+    image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
+    pre_build_image: true
+    privileged: true
+    command: ${MOLECULE_DOCKER_COMMAND:-""}
+    groups:
+      - resources
+    networks:
+      - name: resource-data
+    volumes:
+      - /sys/fs/cgroup:/sys/fs/cgroup:ro
+      #  - ${HOME}/resource-data:/data:rw  # mount fs from host to get nfs exportfs task working
+
+  - name: infrastructure-server
+    image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
+    pre_build_image: true
+    privileged: true
+    command: ${MOLECULE_DOCKER_COMMAND:-""}
+    groups:
+      - infrastructure
+    networks:
+      - name: resource-data
+    volumes:
+      - /sys/fs/cgroup:/sys/fs/cgroup:ro
+
+provisioner:
+  name: ansible
+  log: true
+  lint:
+    name: ansible-lint
+  env:
+    ANSIBLE_ROLES_PATH: ../../../../test/roles/
+scenario:
+  name: default
+verifier:
+  name: testinfra
+  lint:
+    name: flake8
 
--- /dev/null
+---
+- name: Converge
+  hosts: all
+  roles:
+    - setup
+    - resource-data
 
--- /dev/null
+---
+- name: Prepare resource-data
+  hosts: all
+  roles:
+    - prepare-resource-data
 
--- /dev/null
+import os
+import pytest
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('infrastructure-server')
+
+
+@pytest.fixture
+def group_vars(host):
+    all_file = "file=group_vars/all.yml name=all"
+    return host.ansible("include_vars", all_file)["ansible_facts"]["all"]
+
+
+@pytest.mark.parametrize('dir', [
+  'app_data_path',
+  'aux_data_path'
+])
+def test_data_target_dirs(host, dir, group_vars):
+    tested_dir = host.file(group_vars[dir])
+    assert tested_dir.exists
+    assert tested_dir.is_directory
+
+
+@pytest.mark.parametrize('target_file', [
+  'resource1.txt',
+  'resource2.txt',
+  'resource3.txt',
+  'somedir/resource4.txt'
+])
+def test_transferred_resources_files(host, target_file, group_vars):
+    tested_file = host.file(group_vars["app_data_path"] + "/" + target_file)
+    assert tested_file.exists
+    assert tested_file.is_file
+
+    flag_file = \
+        host.file(group_vars["app_data_path"] + "/" +
+                  group_vars["resources_filename"] + "-uploaded")
+    assert flag_file.exists
+    assert flag_file.is_file
+
+
+@pytest.mark.parametrize('target_file', [
+  'auxdata'
+])
+def test_transferred_aux_resources_files(host, target_file, group_vars):
+    tested_file = host.file(group_vars["aux_data_path"] + "/" + target_file)
+    assert tested_file.exists
+    assert tested_file.is_file
+
+    flag_file = \
+        host.file(group_vars["aux_data_path"] + "/" +
+                  group_vars["aux_resources_filename"] + "-uploaded")
+    assert flag_file.exists
+    assert flag_file.is_file
 
       unarchive:
         src: "/tmp/resource_data/{{ resource_source_filename }}"
         dest: "{{ resource_destination_directory }}"
-        remote_src: yes
+        remote_src: true
   always:
     - name: Unmount resource dir
       mount:
 
--- /dev/null
+---
+resources_on_nfs: false
\ No newline at end of file
 
--- /dev/null
+---
+- include_tasks: prepare-resource-server.yml
+  vars:
+    subdir: somedir
+  when: inventory_hostname in groups.resources
+
+- include_tasks: prepare-infra-server.yml
+  when: inventory_hostname in groups.infrastructure
 
--- /dev/null
+---
+- name: Make sure the target dirs (where data is put i.e. what the whole resource-data role is testing) are empty at first
+  file:
+    path: "{{ item }}"
+    state: absent
+  loop:
+    - aux_data_path
+    - app_data_path
+
+- name: Install nfs-utils
+  package:
+    name: nfs-utils
+    state: present
+  when:
+    - resources_on_nfs is defined
+    - resources_on_nfs
 
--- /dev/null
+---
+- name: Install file exacutable if not there for archive compression checking
+  package:
+    name: file
+    state: present
+
+- name: "Create resource dir {{ resources_dir }}"
+  file:
+    path: "{{ resources_dir }}/{{ subdir }}"
+    state: directory
+
+- name: Create test files for the dummy packages
+  file:
+    path: "{{ item }}"
+    state: touch
+  loop:
+    - "{{ resources_dir }}/resource1.txt"
+    - "{{ resources_dir }}/resource2.txt"
+    - "{{ resources_dir }}/resource3.txt"
+    - "{{ resources_dir }}/{{ subdir }}/resource4.txt"
+    - "{{ resources_dir }}/auxdata"
+
+- name: Create resources tar archive for testing
+  archive:
+    path:
+      - "{{ resources_dir }}/resource*"
+      - "{{ resources_dir }}/{{ subdir }}/resource*"
+    dest: "{{ resources_dir }}/{{ resources_filename }}"
+  when:
+    - resources_filename is defined
+    - resources_filename is not none
+
+- name: Create aux tar archive for testing
+  archive:
+    path: "{{ resources_dir }}/aux*"
+    dest: "{{ resources_dir }}/{{ aux_resources_filename }}"
+  when:
+    - aux_resources_filename is defined
+    - aux_resources_filename is not none
+
+- block:
+    - name: Install nfs-utils
+      package:
+        name: nfs-utils
+        state: present
+
+    - name: Start services
+      systemd:
+        name: "{{ item }}"
+        state: started
+      loop:
+        - rpcbind
+        - nfs
+
+    - name: Create data dir to host machine for nfs mount. Must match with volume mount in molecule.yml
+      file:
+        path: ~{{ resources_dir }}
+        state: directory
+      delegate_to: localhost
+
+    - name: Add hosts to exports
+      template:
+        src: exports.j2
+        dest: /etc/exports
+      vars:
+        nfs_mount_path: "{{ resources_dir }}"
+
+    - name: Export nfs
+      command: exportfs -ar
+  when:
+    - resources_on_nfs is defined
+    - resources_on_nfs
 
--- /dev/null
+{% for host in groups.infrastructure -%}
+    {{ nfs_mount_path }}  {{ hostvars[host].inventory_hostname }}(ro,sync,no_root_squash,no_subtree_check)
+{% endfor %}