Index files for Kalamar-Plugin-ExternalResources
Change-Id: I621e3dea2ef174fe6056b3c0428974435634ac57
diff --git a/deploy-kalamar-plugin-externalresources.yml b/deploy-kalamar-plugin-externalresources.yml
index 64aebcc..95d8322 100644
--- a/deploy-kalamar-plugin-externalresources.yml
+++ b/deploy-kalamar-plugin-externalresources.yml
@@ -6,7 +6,7 @@
run_once: true
tasks:
- name: Save docker image
- local_action: ansible.builtin.command docker save korap/kalamar-plugin-externalresources:latest -o ./kalamar-plugin-externalresources-latest.tar
+ local_action: ansible.builtin.command docker save {{ external_image }} -o ./kalamar-plugin-externalresources-latest.tar
- name: Copy docker image to hosts
ansible.builtin.copy:
@@ -30,6 +30,7 @@
- name: Gracefully stop and remove old docker container, if existing
community.docker.docker_container:
+ image: "{{ external_image }}"
state: "absent"
name: "{{ external_container_name }}"
recreate: true
@@ -39,7 +40,7 @@
- name: Restart docker container
community.docker.docker_container:
- image: korap/kalamar-plugin-externalresources:latest
+ image: "{{ external_image }}"
restart_policy: "unless-stopped"
pull: false
name: "{{ external_container_name }}"
@@ -54,6 +55,6 @@
source: "{{ external_path }}/.env"
target: "/.env"
ports:
- - "5722:5722"
+ - "{{ external_port }}"
comparisons:
image: ignore # do not restart containers with older versions of the image
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 }}"
diff --git a/inventory b/inventory
index 601aec7..467feb8 100644
--- a/inventory
+++ b/inventory
@@ -28,7 +28,13 @@
[test:vars]
external_path="/opt/korap/instance-test/Kalamar-External"
external_container_name="kalamar-plugin-externalresources-test"
+external_indexer_name="kalamar-plugin-externalresources-index-test"
+external_port="5722:5722"
+external_image="korap/kalamar-plugin-externalresources:latest"
[main:vars]
external_path="/opt/korap/instance-main/Plugin-External"
external_container_name="kalamar-plugin-externalresources-main"
+external_indexer_name="kalamar-plugin-externalresources-index-main"
+external_port="5722:5722"
+external_image="korap/kalamar-plugin-externalresources:latest"