Fix version_compare usage

This commit is contained in:
Maarten Bezemer 2016-11-04 16:04:31 +01:00
parent 523270405e
commit 65238c74bd
6 changed files with 13 additions and 13 deletions

View file

@ -48,18 +48,18 @@
- name: Copy Logging.yml File for Instance - name: Copy Logging.yml File for Instance
template: src=logging.yml.j2 dest={{conf_dir}}/logging.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes template: src=logging.yml.j2 dest={{conf_dir}}/logging.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
notify: restart elasticsearch notify: restart elasticsearch
when: es_version | version_compare('2.0', '<=') when: es_version | version_compare('5.0', '<')
- name: Copy log4j2.properties File for Instance - name: Copy log4j2.properties File for Instance
template: src=log4j2.properties.j2 dest={{conf_dir}}/log4j2.properties owner={{ es_user }} group={{ es_group }} mode=0644 force=yes template: src=log4j2.properties.j2 dest={{conf_dir}}/log4j2.properties owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
notify: restart elasticsearch notify: restart elasticsearch
when: es_version | version_compare('2.0', '>') when: es_version | version_compare('5.0', '>=')
# Copy the JVM Options (5.x only) # Copy the JVM Options (5.x only)
- name: Copy jvm.options File for Instance - name: Copy jvm.options File for Instance
template: src=jvm.options.j2 dest={{conf_dir}}/jvm.options owner={{ es_user }} group={{ es_group }} mode=0644 force=yes template: src=jvm.options.j2 dest={{conf_dir}}/jvm.options owner={{ es_user }} group={{ es_group }} mode=0644 force=yes
notify: restart elasticsearch notify: restart elasticsearch
when: es_version | version_compare('2.0', '>') when: es_version | version_compare('5.0', '>=')
#Clean up un-wanted package scripts to avoid confusion #Clean up un-wanted package scripts to avoid confusion

View file

@ -14,7 +14,7 @@ DATA_DIR={{ data_dirs | array_to_str }}
# Elasticsearch logs directory # Elasticsearch logs directory
LOG_DIR={{log_dir}} LOG_DIR={{log_dir}}
{% if es_version | version_compare('2.0', '<=') %} {% if es_version | version_compare('5.0', '<') %}
# Elasticsearch work directory # Elasticsearch work directory
WORK_DIR={{work_dir}} WORK_DIR={{work_dir}}
{% endif %} {% endif %}
@ -22,7 +22,7 @@ WORK_DIR={{work_dir}}
# Elasticsearch PID directory # Elasticsearch PID directory
PID_DIR={{pid_dir}} PID_DIR={{pid_dir}}
{% if es_version | version_compare('2.0', '<=') %} {% if es_version | version_compare('5.0', '<') %}
# Heap size defaults to 256m min, 1g max # Heap size defaults to 256m min, 1g max
# Set ES_HEAP_SIZE to 50% of available RAM, but no more than 31g # Set ES_HEAP_SIZE to 50% of available RAM, but no more than 31g
{% if es_heap_size is defined %} {% if es_heap_size is defined %}
@ -78,7 +78,7 @@ MAX_OPEN_FILES={{es_max_open_files}}
{% endif %} {% endif %}
# The maximum number of bytes of memory that may be locked into RAM # The maximum number of bytes of memory that may be locked into RAM
# Set to "unlimited" if you use the 'bootstrap.{% if es_version | version_compare('2.0', '>') %}memory_lock{% else %}mlockall{% endif %}: true' option # Set to "unlimited" if you use the 'bootstrap.{% if es_version | version_compare('5.0', '<=') %}memory_lock{% else %}mlockall{% endif %}: true' option
# in elasticsearch.yml (ES_HEAP_SIZE must also be set). # in elasticsearch.yml (ES_HEAP_SIZE must also be set).
# When using Systemd, the LimitMEMLOCK property must be set # When using Systemd, the LimitMEMLOCK property must be set
# in /usr/lib/systemd/system/elasticsearch.service # in /usr/lib/systemd/system/elasticsearch.service

View file

@ -18,8 +18,8 @@ path.conf: {{ conf_dir }}
path.data: {{ data_dirs | array_to_str }} path.data: {{ data_dirs | array_to_str }}
{% if es_version | version_compare('2.0', '<=') %} {% if es_version | version_compare('5.0', '<') %}
path.work: {{ work_dir }} path.work: {{ work_dir }}
{% endif %} {% endif %}
path.logs: {{ log_dir }} path.logs: {{ log_dir }}

View file

@ -104,7 +104,7 @@ fi
# Define other required variables # Define other required variables
PID_FILE="$PID_DIR/$NAME.pid" PID_FILE="$PID_DIR/$NAME.pid"
DAEMON={{es_home}}/bin/elasticsearch DAEMON={{es_home}}/bin/elasticsearch
{% if es_version | version_compare('2.0', '<=') %} {% if es_version | version_compare('5.0', '<') %}
DAEMON_OPTS="-d -p $PID_FILE --default.path.home=$ES_HOME --default.path.logs=$LOG_DIR --default.path.data=$DATA_DIR --default.path.conf=$CONF_DIR" DAEMON_OPTS="-d -p $PID_FILE --default.path.home=$ES_HOME --default.path.logs=$LOG_DIR --default.path.data=$DATA_DIR --default.path.conf=$CONF_DIR"
{% else %} {% else %}
DAEMON_OPTS="-d -p $PID_FILE -Edefault.path.home=$ES_HOME -Edefault.path.logs=$LOG_DIR -Edefault.path.data=$DATA_DIR -Edefault.path.conf=$CONF_DIR" DAEMON_OPTS="-d -p $PID_FILE -Edefault.path.home=$ES_HOME -Edefault.path.logs=$LOG_DIR -Edefault.path.data=$DATA_DIR -Edefault.path.conf=$CONF_DIR"

View file

@ -3,7 +3,7 @@
# elasticsearch <summary> # elasticsearch <summary>
# #
# chkconfig: 2345 80 20 # chkconfig: 2345 80 20
# description: Starts and stops a single elasticsearch instance on this system # description: Starts and stops a single elasticsearch instance on this system
# #
### BEGIN INIT INFO ### BEGIN INIT INFO
@ -116,7 +116,7 @@ start() {
cd $ES_HOME cd $ES_HOME
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
# if not running, start it up here, usually something like "daemon $exec" # if not running, start it up here, usually something like "daemon $exec"
{% if es_version | version_compare('2.0', '<=') %} {% if es_version | version_compare('5.0', '<') %}
daemon --user $ES_USER --pidfile $pidfile $exec -p $pidfile -d -Des.default.path.home=$ES_HOME -Des.default.path.logs=$LOG_DIR -Des.default.path.data=$DATA_DIR -Des.default.path.conf=$CONF_DIR daemon --user $ES_USER --pidfile $pidfile $exec -p $pidfile -d -Des.default.path.home=$ES_HOME -Des.default.path.logs=$LOG_DIR -Des.default.path.data=$DATA_DIR -Des.default.path.conf=$CONF_DIR
{% else %} {% else %}
daemon --user $ES_USER --pidfile $pidfile $exec -p $pidfile -d -Edefault.path.home=$ES_HOME -Edefault.path.logs=$LOG_DIR -Edefault.path.data=${DATA_DIR} -Edefault.path.conf=$CONF_DIR daemon --user $ES_USER --pidfile $pidfile $exec -p $pidfile -d -Edefault.path.home=$ES_HOME -Edefault.path.logs=$LOG_DIR -Edefault.path.data=${DATA_DIR} -Edefault.path.conf=$CONF_DIR

View file

@ -22,7 +22,7 @@ ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec
{% endif %} {% endif %}
ExecStart={{es_home}}/bin/elasticsearch \ ExecStart={{es_home}}/bin/elasticsearch \
{% if es_version | version_compare('2.0', '<=') %} {% if es_version | version_compare('5.0', '<') %}
-Des.pidfile=${PID_DIR}/elasticsearch.pid \ -Des.pidfile=${PID_DIR}/elasticsearch.pid \
-Des.default.path.home=${ES_HOME} \ -Des.default.path.home=${ES_HOME} \
-Des.default.path.logs=${LOG_DIR} \ -Des.default.path.logs=${LOG_DIR} \
@ -45,7 +45,7 @@ StandardError=inherit
LimitNOFILE={{es_max_open_files}} LimitNOFILE={{es_max_open_files}}
# Specifies the maximum number of bytes of memory that may be locked into RAM # Specifies the maximum number of bytes of memory that may be locked into RAM
# Set to "infinity" if you use the 'bootstrap.{% if es_version | version_compare('2.0', '>') %}memory_lock{% else %}mlockall{% endif %}: true' option # Set to "infinity" if you use the 'bootstrap.{% if es_version | version_compare('5.0', '<=') %}memory_lock{% else %}mlockall{% endif %}: true' option
# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in {{instance_default_file}} # in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in {{instance_default_file}}
{% if m_lock_enabled %} {% if m_lock_enabled %}
LimitMEMLOCK=infinity LimitMEMLOCK=infinity