|
1 | 1 | --- |
2 | | -## create the searchengine and elasticsearch folders |
3 | 2 |
|
| 3 | +#Add all elasticsearch nodes |
| 4 | +- name: omero searchengine | Add elastic nodes to elasticsearch_nodes |
| 5 | + ansible.builtin.set_fact: |
| 6 | + elasticsearch_nodes: '{{ elasticsearch_nodes + ["searchengine_elasticsearch_node"+item] }}' |
| 7 | + cacheable: yes |
| 8 | + with_sequence: start=1 count={{ elasticsearch_no_nodes }} |
| 9 | + |
| 10 | +#Add all elasticsearch nodes |
| 11 | +- name: omero searchengine | Add elastic nodes to elasticsearch_nodes_urls |
| 12 | + ansible.builtin.set_fact: |
| 13 | + elasticsearch_nodes_urls: '{{ elasticsearch_nodes_urls + ["https://10.11.0."+item+":9200"] }}' |
| 14 | + cacheable: yes |
| 15 | + with_sequence: start=2 count={{ elasticsearch_no_nodes }} |
4 | 16 |
|
5 | 17 | - name: omero searchengine | Ensure sysctl is present |
6 | 18 | ansible.builtin.package: |
|
28 | 40 | ansible.builtin.import_role: |
29 | 41 | name: ome.docker |
30 | 42 |
|
| 43 | +- name: omero searchengine | Get Docker information |
| 44 | + community.docker.docker_host_info: |
| 45 | + containers: true |
| 46 | + containers_all: true |
| 47 | + register: searchengine_docker_info |
| 48 | + |
| 49 | +- name: omero searchengine | Get list of container names |
| 50 | + set_fact: |
| 51 | + searchengine_container_names: >- |
| 52 | + {{ |
| 53 | + searchengine_docker_info.containers |
| 54 | + | map(attribute='Names') |
| 55 | + | flatten |
| 56 | + | map('regex_replace', '^/', '') |
| 57 | + | list |
| 58 | + }} |
| 59 | + cacheable: yes |
| 60 | + |
| 61 | +- name: omero searchengine | Stop and delete running containers |
| 62 | + community.docker.docker_container: |
| 63 | + name: "{{ item }}" |
| 64 | + state: absent #stopped |
| 65 | + loop: "{{ searchengine_container_names }}" |
| 66 | + when: |
| 67 | + - item in elasticsearch_nodes or item in search_container_names |
| 68 | + - not molecule_yml is defined |
| 69 | + |
| 70 | +- name: omero searchengine | remove app directory |
| 71 | + become: yes |
| 72 | + ansible.builtin.file: |
| 73 | + path: "{{ apps_folder }}/searchengine" |
| 74 | + state: absent |
| 75 | + when: prune_app_folder |
| 76 | + |
31 | 77 | - name: omero searchengine | Check if a elastic node data folder exists |
32 | 78 | ansible.builtin.stat: |
33 | 79 | path: "{{ apps_folder }}/searchengine/elasticsearch/node1/data" |
|
55 | 101 | mode: 0755 |
56 | 102 | changed_when: false |
57 | 103 |
|
58 | | - |
59 | 104 | - name: omero searchengine | Create elasticsearch certs folder |
60 | 105 | become: yes |
61 | 106 | ansible.builtin.file: |
|
108 | 153 |
|
109 | 154 | - name: omero searchengine | deploy elasticsearch cluster |
110 | 155 | ansible.builtin.include_tasks: elasticsearch.yml |
111 | | - when: not elastic_node_data_folder.stat.exists or force_update |
112 | 156 |
|
113 | 157 | - name: omero searchengine | deploy nginx for the search engine |
114 | 158 | ansible.builtin.import_tasks: nginx.yml |
115 | | - when: not test_mode |
| 159 | + when: not molecule_yml is defined |
116 | 160 |
|
117 | 161 | - name: omero searchengine | deploy redis |
118 | 162 | ansible.builtin.import_tasks: redis.yml |
119 | | - when: not test_mode and support_async |
| 163 | + when: not molecule_yml is defined |
120 | 164 |
|
121 | 165 | - name: omero searchengine | deploy searchengine |
122 | 166 | ansible.builtin.import_tasks: searchengine.yml |
0 commit comments