Index files for Kalamar-Plugin-ExternalResources

Change-Id: I621e3dea2ef174fe6056b3c0428974435634ac57
diff --git a/index-kalamar-plugin-externalresources.yml b/index-kalamar-plugin-externalresources.yml
new file mode 100644
index 0000000..6b91eaf
--- /dev/null
+++ b/index-kalamar-plugin-externalresources.yml
@@ -0,0 +1,54 @@
+# Call as
+# $ ansible-playbook -l test -e source_file="/export/netapp/kupietz/genios-fulltext-mappings.csv.gz" index-kalamar-plugin-externalresources.yml
+- name: Index Kalamar-Plugin-ExternalResources
+  hosts: test, main
+  serial: 1
+  tasks:
+    - name: Get UID for KorAP user
+      getent:
+        database: passwd
+        key: korap
+
+    - name: Stop and remove docker container, if existing
+      community.docker.docker_container:
+        image: "{{ external_image }}"
+        state: "absent"
+        name: "{{ external_container_name }}"
+        
+    - name: Start docker container for indexation
+      community.docker.docker_container:
+        image: "{{ external_image }}"
+        restart_policy: "no"
+        pull: false
+        name: "{{ external_indexer_name }}"
+        user: "{{ ansible_facts.getent_passwd[\"korap\"].1 }}"
+        detach: false
+        mounts:
+          - type: bind
+            source: "{{ external_path }}/db"
+            target: "/db"
+          - type: bind
+            source: "{{ external_path }}/.env"
+            target: "/.env"
+          - type: bind
+            source: "{{ source_file }}"
+            target: "{{ source_file }}"
+        command: "{{ source_file }}"
+
+    - name: Restart docker container
+      community.docker.docker_container:
+        image: "{{ external_image }}"
+        restart_policy: "unless-stopped"
+        pull: false
+        name: "{{ external_container_name }}"
+        user: "{{ ansible_facts.getent_passwd[\"korap\"].1 }}"
+        detach: true
+        mounts:
+          - type: bind
+            source: "{{ external_path }}/db"
+            target: "/db"
+          - type: bind
+            source: "{{ external_path }}/.env"
+            target: "/.env"
+        ports:
+          - "{{ external_port }}"