diff --git a/salt/elasticsearch/config.map.jinja b/salt/elasticsearch/config.map.jinja index c3f2b2067..c44e39e0d 100644 --- a/salt/elasticsearch/config.map.jinja +++ b/salt/elasticsearch/config.map.jinja @@ -33,4 +33,15 @@ {% endif %} {% endif %} +{# merge with the elasticsearch pillar #} {% set ESCONFIG = salt['pillar.get']('elasticsearch:config', default=ESCONFIG.elasticsearch.config, merge=True) %} + +{# remove elasticsearch.config.path.repo values if a symlink /nsm/elasticsearch/repo{{ repo }} doesn't exist #} +{% if salt['pillar.get']('elasticsearch:config:path:repo', False) %} + {% for repo in pillar.elasticsearch.config.path.repo %} + {# retcode is 1 if symlink doesn't exist #} + {% if salt['cmd.retcode']('test -L /nsm/elasticsearch/repo'~repo) %} + {% do ESCONFIG.path.repo.remove(repo) %} + {% endif %} + {% endfor %} +{% endif %} diff --git a/salt/elasticsearch/init.sls b/salt/elasticsearch/init.sls index 83dfb63f1..8060757ed 100644 --- a/salt/elasticsearch/init.sls +++ b/salt/elasticsearch/init.sls @@ -24,7 +24,6 @@ include: {% set NODEIP = salt['pillar.get']('elasticsearch:mainip', '') -%} {% set TRUECLUSTER = salt['pillar.get']('elasticsearch:true_cluster', False) %} {% set MANAGERIP = salt['pillar.get']('global:managerip') %} -{% set ESMOUNT = salt['pillar.get']('elasticsearch:extramount', False) %} {% if grains['role'] in ['so-eval','so-managersearch', 'so-manager', 'so-standalone', 'so-import'] %} {% set esclustername = salt['pillar.get']('manager:esclustername') %} @@ -235,6 +234,14 @@ eslogdir: - group: 939 - makedirs: True +es_repo_dir: + file.directory: + - name: /nsm/elasticsearch/repo/ + - user: 930 + - group: 930 + - require: + - file: nsmesdir + auth_users: file.managed: - name: /opt/so/conf/elasticsearch/users.tmp @@ -317,8 +324,10 @@ so-elasticsearch: - /opt/so/conf/elasticsearch/users_roles:/usr/share/elasticsearch/config/users_roles:ro - /opt/so/conf/elasticsearch/users:/usr/share/elasticsearch/config/users:ro {% endif %} - {% if ESMOUNT %} - - {{ ESMOUNT }}:/snapshots:rw + {% if ESCONFIG.path.get('repo', False) %} + {% for repo in ESCONFIG.path.repo %} + - /nsm/elasticsearch/repo{{ repo }}:{{ repo }}:rw + {% endfor %} {% endif %} - watch: - file: cacertz