Akron | 700679f | 2024-03-19 16:41:36 +0100 | [diff] [blame] | 1 | # Call as |
| 2 | # $ ansible-playbook -l test -e source_file="/export/netapp/kupietz/genios-fulltext-mappings.csv.gz" index-kalamar-plugin-externalresources.yml |
| 3 | - name: Index Kalamar-Plugin-ExternalResources |
| 4 | hosts: test, main |
| 5 | serial: 1 |
| 6 | tasks: |
| 7 | - name: Get UID for KorAP user |
| 8 | getent: |
| 9 | database: passwd |
| 10 | key: korap |
| 11 | |
| 12 | - name: Stop and remove docker container, if existing |
| 13 | community.docker.docker_container: |
| 14 | image: "{{ external_image }}" |
| 15 | state: "absent" |
| 16 | name: "{{ external_container_name }}" |
| 17 | |
| 18 | - name: Start docker container for indexation |
| 19 | community.docker.docker_container: |
| 20 | image: "{{ external_image }}" |
| 21 | restart_policy: "no" |
| 22 | pull: false |
| 23 | name: "{{ external_indexer_name }}" |
| 24 | user: "{{ ansible_facts.getent_passwd[\"korap\"].1 }}" |
| 25 | detach: false |
| 26 | mounts: |
| 27 | - type: bind |
| 28 | source: "{{ external_path }}/db" |
| 29 | target: "/db" |
| 30 | - type: bind |
| 31 | source: "{{ external_path }}/.env" |
| 32 | target: "/.env" |
| 33 | - type: bind |
| 34 | source: "{{ source_file }}" |
| 35 | target: "{{ source_file }}" |
| 36 | command: "{{ source_file }}" |
| 37 | |
| 38 | - name: Restart docker container |
| 39 | community.docker.docker_container: |
| 40 | image: "{{ external_image }}" |
| 41 | restart_policy: "unless-stopped" |
| 42 | pull: false |
| 43 | name: "{{ external_container_name }}" |
| 44 | user: "{{ ansible_facts.getent_passwd[\"korap\"].1 }}" |
| 45 | detach: true |
| 46 | mounts: |
| 47 | - type: bind |
| 48 | source: "{{ external_path }}/db" |
| 49 | target: "/db" |
| 50 | - type: bind |
| 51 | source: "{{ external_path }}/.env" |
| 52 | target: "/.env" |
| 53 | ports: |
| 54 | - "{{ external_port }}" |