blob: 549607efd5632082f5b022cad052b6790ff846c1 [file] [log] [blame]
Akrona79b6ff2024-03-15 12:32:44 +01001- name: Deploy Kalamar-Plugin-ExternalResources to Test instance
2 hosts:
3 test-instance
4 user: korap
5 serial: 1
6 tasks:
7 - name: Save docker image
8 local_action: ansible.builtin.command docker save korap/kalamar-plugin-externalresources:latest -o ./kalamar-plugin-externalresources-latest.tar
9 - name: Copy docker image to hosts
10 ansible.builtin.copy:
11 src: ./kalamar-plugin-externalresources-latest.tar
12 dest: /opt/korap/instance-test/Kalamar-External/kalamar-plugin-externalresources-latest.tar
13 mode: '0644'
14 - name: Load docker image on host
15 ansible.builtin.command: docker load -i /opt/korap/instance-test/Kalamar-External/kalamar-plugin-externalresources-latest.tar
16 - name: Get UID for KorAP user
17 getent:
18 database: passwd
19 key: korap
20 - name: Gracefully stop and remove old docker container, if existing
21 community.docker.docker_container:
22 state: "absent"
23 name: kalamar-plugin-externalresources-test
24 recreate: true
25 keep_volumes: true
26 comparisons:
27 image: ignore # do not restart containers with older versions of the image
28 - name: Restart docker container
29 community.docker.docker_container:
30 image: korap/kalamar-plugin-externalresources:latest
31 restart_policy: "unless-stopped"
32 pull: false
33 name: kalamar-plugin-externalresources-test
34 user: "{{ ansible_facts.getent_passwd[\"korap\"].1 }}"
35 init: true
36 detach: true
37 mounts:
38 - type: bind
39 source: "/opt/korap/instance-test/Kalamar-External/db"
40 target: "/db"
41 - type: bind
42 source: "/opt/korap/instance-test/Kalamar-External/.env"
43 target: "/.env"
44 ports:
45 - "5722:5722"
46 comparisons:
47 image: ignore # do not restart containers with older versions of the image