Improve inventory to make deployment targets definable

Change-Id: Ib83479773b8a8024c40c0dac36ded2b0ff2747c4
diff --git a/deploy-kalamar-plugin-externalresources.yml b/deploy-kalamar-plugin-externalresources.yml
index d77ef5d..64aebcc 100644
--- a/deploy-kalamar-plugin-externalresources.yml
+++ b/deploy-kalamar-plugin-externalresources.yml
@@ -1,21 +1,17 @@
 - name: Deploy Kalamar-Plugin-ExternalResources
   hosts:
-    test-instance
-  user: korap
+    - test
+    - main
   serial: 1
+  run_once: true
   tasks:
-    - name: Set instance
-      set_fact:
-        instance_path: "/opt/korap/instance-test/Kalamar-External"
-        instance_name: "kalamar-plugin-externalresources-test"
-
     - name: Save docker image
       local_action: ansible.builtin.command docker save korap/kalamar-plugin-externalresources:latest -o ./kalamar-plugin-externalresources-latest.tar
 
     - name: Copy docker image to hosts
       ansible.builtin.copy:
         src: ./kalamar-plugin-externalresources-latest.tar
-        dest: "{{ instance_path}}/kalamar-plugin-externalresources-latest.tar"
+        dest: "{{ external_path }}/kalamar-plugin-externalresources-latest.tar"
         mode: '0644'
 
     - name: Delete docker image tar
@@ -25,7 +21,7 @@
           state: absent
         
     - name: Load docker image on host
-      ansible.builtin.command: "docker load -i {{ instance_path}}/kalamar-plugin-externalresources-latest.tar"
+      ansible.builtin.command: "docker load -i {{ external_path }}/kalamar-plugin-externalresources-latest.tar"
 
     - name: Get UID for KorAP user
       getent:
@@ -35,7 +31,7 @@
     - name: Gracefully stop and remove old docker container, if existing
       community.docker.docker_container:
         state: "absent"
-        name: "{{ instance_name }}"
+        name: "{{ external_container_name }}"
         recreate: true
         keep_volumes: true
         comparisons:
@@ -46,16 +42,16 @@
         image: korap/kalamar-plugin-externalresources:latest
         restart_policy: "unless-stopped"
         pull: false
-        name: "{{ instance_name }}"
+        name: "{{ external_container_name }}"
         user: "{{ ansible_facts.getent_passwd[\"korap\"].1 }}"
         init: true
         detach: true
         mounts:
           - type: bind
-            source: "{{ instance_path }}/db"
+            source: "{{ external_path }}/db"
             target: "/db"
           - type: bind
-            source: "{{ instance_path }}/.env"
+            source: "{{ external_path }}/.env"
             target: "/.env"
         ports:
           - "5722:5722"
diff --git a/inventory b/inventory
index 785727d..601aec7 100644
--- a/inventory
+++ b/inventory
@@ -1,25 +1,34 @@
 [korap]
-10.0.10.55
+head-01    ansible_host=10.0.10.51
+head-02    ansible_host=10.0.10.52
+worker-01  ansible_host=10.0.10.53
+worker-02  ansible_host=10.0.10.54
+worker-03  ansible_host=10.0.10.55
+worker-04  ansible_host=10.0.10.56
+worker-05  ansible_host=10.0.10.57
+worker-06  ansible_host=10.0.10.58
+worker-07  ansible_host=10.0.10.59
+worker-08  ansible_host=10.0.10.60
 
-[main-instance]
-10.0.10.51
+[main]
+head-01
 
-[test-instance]
-10.0.10.52
+[test]
+head-02
 
 [krawfish]
-10.0.10.57
-10.0.10.58
-10.0.10.59
-
-[krawfish:vars]
-ansible_python_interpreter=/usr/bin/python3
+worker-05
+worker-06
+worker-07
 
 [korap:vars]
 ansible_python_interpreter=/usr/bin/python3
+ansible_user=korap
 
-[main-instance:vars]
-ansible_python_interpreter=/usr/bin/python3
+[test:vars]
+external_path="/opt/korap/instance-test/Kalamar-External"
+external_container_name="kalamar-plugin-externalresources-test"
 
-[test-instance:vars]
-ansible_python_interpreter=/usr/bin/python3
+[main:vars]
+external_path="/opt/korap/instance-main/Plugin-External"
+external_container_name="kalamar-plugin-externalresources-main"
diff --git a/list-dereko-korap-release.yml b/list-dereko-korap-release.yml
index 4bbffb6..f78c6a3 100644
--- a/list-dereko-korap-release.yml
+++ b/list-dereko-korap-release.yml
@@ -1,6 +1,6 @@
 - name: List DeReKo-KorAP Releases
-  hosts: 10.0.10.55
-  user: korap
+  hosts: worker-03
+  run_once: true
   tasks:
     - name: Get current year
       set_fact: