Skip to content

Commit 10195c3

Browse files
committed
Do not run search index rebuild by default
The search index rebuild is not required by default when updating Zammad. Since this is a time consuming operation it should not be executed unless explicitly required.
1 parent 48fc65b commit 10195c3

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

roles/zammad/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ elasticsearch_url: "http://localhost:9200"
124124

125125
Elasticsearch server address.
126126

127+
```yaml
128+
zammad_force_es_searchindex_rebuild: false
129+
```
130+
131+
By default, the Elasticsearch indexes are only rebuilt during the initial
132+
installation.
133+
Set this variable to `true` to force Ansible to trigger the rebuild of the
134+
Zammad search index when Zammad is updated.
135+
127136
## Dependencies
128137

129138
Zammad requires Elasticsearch and PostgreSQL database server.

roles/zammad/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ zammad_ssl_key_path: "/etc/ssl/private/zammad_key.pem"
1515
zammad_nginx_additional_server_configs: []
1616
zammad_nginx_server_tokens: "off"
1717

18+
zammad_force_es_searchindex_rebuild: false
19+
1820
elasticsearch_url: "http://localhost:9200"
1921
...

roles/zammad/handlers/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
- name: "Build search index"
1818
ansible.builtin.command: "zammad run rake zammad:searchindex:rebuild"
1919
changed_when: true
20+
when: "not __zammad_is_installed or zammad_force_es_searchindex_rebuild"
2021

2122
...

roles/zammad/tasks/install.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
update_cache: true
4444
mode: "0644"
4545

46+
- name: "Gather the package facts to check wether Zammad has already been installed"
47+
ansible.builtin.package_facts:
48+
manager: "auto"
49+
50+
- name: "Check if Zammad is already installed"
51+
ansible.builtin.set_fact:
52+
__zammad_is_installed: "{{ 'zammad' in ansible_facts.packages }}"
53+
4654
- name: "Install | Install Zammad package"
4755
ansible.builtin.package:
4856
name: "zammad={{ zammad_version }}*"

0 commit comments

Comments
 (0)