blob: 90d2485732b87a4f2adc4f27c7e22ea686a4580d [file] [log] [blame]
Akronc6072382023-11-07 12:54:54 +01001- name: Deploy Krawfish
2 hosts:
3 10.0.10.57
4 10.0.10.58
5 10.0.10.59
6 user: korap
7 serial: 1
8 tasks:
9 - name: Save docker image
10 local_action: ansible.builtin.command docker save korap/krawfish:latest -o ./krawfish-latest.tar
11 - name: Copy docker image to hosts
12 ansible.builtin.copy:
13 src: ./krawfish-latest.tar
14 dest: /opt/korap/krawfish/krawfish-latest.tar
15 mode: '0644'
16 - name: Load docker images on hosts
17 ansible.builtin.command: docker load -i /opt/korap/krawfish/krawfish-latest.tar
18 - name: Get UID for KorAP user
19 getent:
20 database: passwd
21 key: korap
22 - name: Gracefully stop and remove old docker container, if existing
23 community.docker.docker_container:
24 state: "absent"
25 name: krawfish
26 recreate: true
27 keep_volumes: true
28 comparisons:
29 image: ignore # do not restart containers with older versions of the image
30 - name: Restart docker container
31 community.docker.docker_container:
32 image: korap/krawfish:latest
33 restart_policy: "unless-stopped"
34 # pull: true
35 name: krawfish
36 user: "{{ ansible_facts.getent_passwd[\"korap\"].1 }}"
37 init: true
38 detach: true
39 mounts:
40 - type: bind
41 source: "/opt/korap/krawfish/log"
42 target: "/log"
43 - type: bind
44 source: "/opt/korap/krawfish/index"
45 target: "/index"
46 - type: bind
47 read_only: true
48 source: "/opt/korap/krawfish/conf.yml"
49 target: "/conf.yml"
50 ports:
51 - "9328:9328"
52 - "9329:9329"
53 - "9587:9587"
54 command: ["-c", "conf.yml"]
55 comparisons:
56 image: ignore # do not restart containers with older versions of the image