diff --git a/.kitchen.yml b/.kitchen.yml index 1bf6f48..2ebe577 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -36,7 +36,7 @@ platforms: - apt-get update -q && apt-get -y -q install ansible openjdk-8-jre python-jmespath - locale-gen en_US.UTF-8 && localedef -i en_US -c -f UTF-8 en_US.UTF-8 use_sudo: false - volume: + volume: - <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json - /etc # This fixes certain java file actions that check the mount point. Without this adding users fails for some docker storage drivers - name: ubuntu-16.04 @@ -45,10 +45,10 @@ platforms: privileged: true provision_command: - apt-get update -q && apt-get install -y -q iproute locales software-properties-common && add-apt-repository -y ppa:ansible/ansible - - apt-get update -q && apt-get install -y -q ansible python-jmespath + - apt-get update -q && apt-get install -y -q ansible python-jmespath - locale-gen en_US.UTF-8 && localedef -i en_US -c -f UTF-8 en_US.UTF-8 use_sudo: false - volume: + volume: - <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json - /etc # This fixes certain java file actions that check the mount point. Without this adding users fails for some docker storage drivers run_command: "/sbin/init" @@ -57,9 +57,9 @@ platforms: image: ubuntu:18.04 privileged: true provision_command: - - apt-get install -y -q ansible iproute2 python-jmespath + - apt-get install -y -q ansible iproute2 python-jmespath use_sudo: false - volume: + volume: - <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json - /etc # This fixes certain java file actions that check the mount point. Without this adding users fails for some docker storage drivers run_command: "/sbin/init" @@ -75,7 +75,7 @@ platforms: - echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" > /etc/apt/sources.list.d/ansible.list - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 - apt-get update -q && apt-get install -y -q ansible - volume: + volume: - <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json - /etc # This fixes certain java file actions that check the mount point. Without this adding users fails for some docker storage drivers use_sudo: false @@ -89,7 +89,7 @@ platforms: - echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" > /etc/apt/sources.list.d/ansible.list - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 - apt-get update -q && apt-get install -y -q ansible - volume: + volume: - <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json - /etc # This fixes certain java file actions that check the mount point. Without this adding users fails for some docker storage drivers use_sudo: false @@ -100,7 +100,7 @@ platforms: provision_command: - yum -y install epel-release - yum -y install ansible iproute python2-jmespath - volume: + volume: - <%=ENV['ES_XPACK_LICENSE_FILE']%>:/tmp/license.json - /etc # This fixes certain java file actions that check the mount point. Without this adding users fails for some docker storage drivers run_command: "/usr/sbin/init" @@ -128,10 +128,6 @@ suites: provisioner: playbook: test/integration/xpack-upgrade.yml idempotency_test: false - - name: multi - provisioner: - playbook: test/integration/multi.yml - idempotency_test: true - name: issue-test provisioner: playbook: test/integration/issue-test.yml diff --git a/README.md b/README.md index ba26cf6..6bdcbb1 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,81 @@ Ansible role for 7.x/6.x Elasticsearch. Currently this works on Debian and RedH The latest Elasticsearch versions of 7.x & 6.x are actively tested. +**BREAKING CHANGES** + +### Notice about multi-instance support + +Starting with ansible-elasticsearch:7.0.0, installing more than one instance of Elasticsearch **on the same host** is no more supported. + +See [554#issuecomment-496804929](https://github.com/elastic/ansible-elasticsearch/issues/554#issuecomment-496804929) for more details about why we remove it. + +If you install more than one instance of ElasticSearch on the same host (with different ports, directory and config files), **do not update to ansible-elasticsearch >= 7.0.0**. + +You are still be able to install Elasticsearch 6.x and 7.x in multi-instance mode by using ansible-elasticsearch commit [25bd09f](https://github.com/elastic/ansible-elasticsearch/commit/25bd09f6835b476b6a078676a7d614489a6739c5) (last commit before multi-instance removal) and overriding `es_version` variable: + +```sh +$ cat << EOF >> requirements.yml # require git +- src: https://github.com/elastic/ansible-elasticsearch + version: 25bd09f + name: elasticsearch +EOF +$ ansible-galaxy install -r requirements.yml +$ cat << EOF >> playbook.yml +- hosts: localhost + roles: + - role: elasticsearch + vars: + es_instance_name: "node1" + es_version: 7.0.1 # or 6.7.2 for example +EOF +$ ansible-playbook playbook.yml +``` + +However for multi-instances use cases, we are now recommending using Docker containers using our official images (https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html). + +#### Upgrade procedure + +If you have single-instances hosts and want to upgrade from previous versions of the role: + +1. Override these variables to match previous values: +```yaml + +es_conf_dir: /etc/elasticsearch/{{ instance_name }} +es_data_dirs: + - /var/lib/elasticsearch/{{ node_name }}-{{ instance_name }} +es_log_dir: /var/log/elasticsearch/{{ node_name }}-{{ instance_name }} +es_pid_dir: /var/run/elasticsearch/{{ node_name }}-{{ instance_name }} +``` + +2. Deploy ansible-role. **Even if these variables are overrided, Elasticsearch config file and default option file will change, which imply an Elasticsearch restart.** + +3. After ansible-role new deployment, you can do some cleanup of old Init file and Default file. + +Example: +```bash +$ ansible-playbook -e '{"es_conf_dir":"/etc/elasticsearch/node1","es_data_dirs":["/var/lib/elasticsearch/localhost-node1"],"es_log_dir":"/var/log/elasticsearch/localhost-node1","es_pid_dir":"/var/run/elasticsearch/localhost-node1"}' playbook.yml +... +TASK [elasticsearch : Create Directories] ********************************************************************************************************************************************************************************************************************** +ok: [localhost] => (item=/var/run/elasticsearch/localhost-node1) +ok: [localhost] => (item=/var/log/elasticsearch/localhost-node1) +ok: [localhost] => (item=/etc/elasticsearch/node1) +ok: [localhost] => (item=/var/lib/elasticsearch/localhost-node1) + +TASK [elasticsearch : Copy Configuration File] ***************************************************************************************************************************************************************************************************************** +changed: [localhost] + +TASK [elasticsearch : Copy Default File] *********************************************************************************************************************************************************************************************************************** +changed: [localhost] +... +PLAY RECAP ***************************************************************************************************************************************************************************************************************************************************** +localhost : ok=32 changed=3 unreachable=0 failed=0 + +$ find /etc -name 'node1_elasticsearch*' +/etc/default/node1_elasticsearch +/etc/systemd/system/multi-user.target.wants/node1_elasticsearch.service +$ rm /etc/default/node1_elasticsearch /etc/systemd/system/multi-user.target.wants/node1_elasticsearch.service +``` + ## Dependency This role uses the json_query filter which [requires jmespath](https://github.com/ansible/ansible/issues/24319) on the local machine. @@ -26,7 +101,7 @@ Create your Ansible playbook with your own tasks, and include the role elasticse ansible-galaxy install git+https://github.com/elastic/ansible-elasticsearch.git,7f5be969e07173c5697432141e909b6ced5a2e94 ``` -Then create your playbook yaml adding the role elasticsearch. By default, the user is only required to specify a unique es_instance_name per role application. This should be unique per node. +Then create your playbook yaml adding the role elasticsearch. The application of the elasticsearch role results in the installation of a node on a host. The simplest configuration therefore consists of: @@ -36,8 +111,6 @@ The simplest configuration therefore consists of: hosts: localhost roles: - role: elastic.elasticsearch - vars: - es_instance_name: "node1" ``` The above installs a single node 'node1' on the hosts 'localhost'. @@ -118,7 +191,6 @@ The following illustrates applying configuration parameters to an Elasticsearch roles: - role: elastic.elasticsearch vars: - es_instance_name: "node1" es_data_dirs: - "/opt/elasticsearch/data" es_log_dir: "/opt/elasticsearch/logs" @@ -131,8 +203,6 @@ The following illustrates applying configuration parameters to an Elasticsearch node.data: false node.master: true bootstrap.memory_lock: true - es_templates: false - es_version_lock: false es_heap_size: 1g es_api_port: 9201 ``` @@ -157,7 +227,6 @@ A more complex example: roles: - role: elastic.elasticsearch vars: - es_instance_name: "node1" es_data_dirs: - "/opt/elasticsearch/data" es_log_dir: "/opt/elasticsearch/logs" @@ -170,11 +239,8 @@ A more complex example: node.data: false node.master: true bootstrap.memory_lock: true - es_templates: false - es_version_lock: false es_heap_size: 1g es_start_service: false - es_plugins_reinstall: false es_api_port: 9201 es_plugins: - plugin: ingest-attachment @@ -191,71 +257,53 @@ If the node is deployed to bind on either a different host or port, these must b The application of the elasticsearch role results in the installation of a node on a host. Specifying the role multiple times for a host therefore results in the installation of multiple nodes for the host. -An example of a two server deployment is shown below. The first server holds the master and is thus declared first. Whilst not mandatory, this is recommended in any multi node cluster configuration. The second server hosts two data nodes. +An example of a three server deployment is shown below. The first server holds the master and is thus declared first. Whilst not mandatory, this is recommended in any multi node cluster configuration. The two others servers hosts data nodes. -**Note the structure of the below playbook for the data nodes. Whilst a more succinct structures are possible which allow the same role to be applied to a host multiple times, we have found the below structure to be the most reliable with respect to var behaviour. This is the tested approach.** +**Note that we do not support anymore installation of more than one node in the same host** ```yaml -- hosts: master_nodes +- hosts: master_node roles: - role: elastic.elasticsearch vars: - es_instance_name: "node1" es_heap_size: "1g" es_config: cluster.name: "test-cluster" discovery.seed_hosts: "elastic02:9300" http.port: 9200 - transport.port: 9300 node.data: false node.master: true bootstrap.memory_lock: false - es_templates: false - es_version_lock: false - ansible_user: ansible es_plugins: - plugin: ingest-attachment -- hosts: data_nodes +- hosts: data_node_1 roles: - role: elastic.elasticsearch vars: - es_instance_name: "node1" es_data_dirs: - "/opt/elasticsearch" es_config: cluster.name: "test-cluster" discovery.seed_hosts: "elastic02:9300" http.port: 9200 - transport.port: 9300 node.data: true node.master: false bootstrap.memory_lock: false - es_templates: false - es_version_lock: false - ansible_user: ansible - es_api_port: 9200 es_plugins: - plugin: ingest-attachment -- hosts: data_nodes +- hosts: data_node_2 roles: - role: elastic.elasticsearch vars: - es_instance_name: "node2" - es_api_port: 9201 es_config: + cluster.name: "test-cluster" discovery.seed_hosts: "elastic02:9300" - http.port: 9201 - transport.port: 9301 + http.port: 9200 node.data: true node.master: false bootstrap.memory_lock: false - cluster.name: "test-cluster" - es_templates: false - es_version_lock: false - es_api_port: 9201 - ansible_user: ansible es_plugins: - plugin: ingest-attachment ``` @@ -432,12 +480,6 @@ To configure X-pack to send mail, the following configuration can be added to th Both ```es_user_id``` and ```es_group_id``` must be set for the user and group ids to be set. -By default, each node on a host will be installed to use unique pid, plugin, work, data and log directories. These directories are created, using the instance and host name, beneath default locations ] -controlled by the following parameters: - -* ```es_pid_dir``` - defaults to "/var/run/elasticsearch". -* ```es_data_dirs``` - defaults to "/var/lib/elasticsearch". This can be a list or comma separated string e.g. ["/opt/elasticsearch/data-1","/opt/elasticsearch/data-2"] or "/opt/elasticsearch/data-1,/opt/elasticsearch/data-2" -* ```es_log_dir``` - defaults to "/var/log/elasticsearch". * ```es_restart_on_change``` - defaults to true. If false, changes will not result in Elasticsearch being restarted. * ```es_plugins_reinstall``` - defaults to false. If true, all currently installed plugins will be removed from a node. Listed plugins will then be re-installed. @@ -465,10 +507,8 @@ To define proxy only for a particular plugin during its installation: * The role assumes the user/group exists on the server. The elasticsearch packages create the default elasticsearch user. If this needs to be changed, ensure the user exists. * The playbook relies on the inventory_name of each host to ensure its directories are unique -* Changing an instance_name for a role application will result in the installation of a new component. The previous component will remain. * KitchenCI has been used for testing. This is used to confirm images reach the correct state after a play is first applied. We currently test the latest version of 7.x and 6.x on all supported platforms. * The role aims to be idempotent. Running the role multiple times, with no changes, should result in no state change on the server. If the configuration is changed, these will be applied and Elasticsearch restarted where required. -* Systemd is used for Ubuntu versions >= 15, Debian >=8, Centos >=7. All other versions use init for service scripts. * In order to run x-pack tests a license file with security enabled is required. A trial license is appropriate. Set the environment variable `ES_XPACK_LICENSE_FILE` to the full path of the license file prior to running tests. ## IMPORTANT NOTES RE PLUGIN MANAGEMENT diff --git a/defaults/main.yml b/defaults/main.yml index 2c5f858..9b93e40 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -21,8 +21,10 @@ es_group: elasticsearch es_config: {} es_config_log4j2: log4j2.properties.j2 #Need to provide default directories +es_conf_dir: "/etc/elasticsearch" es_pid_dir: "/var/run/elasticsearch" -es_data_dirs: "/var/lib/elasticsearch" +es_data_dirs: + - "/var/lib/elasticsearch" es_log_dir: "/var/log/elasticsearch" es_action_auto_create_index: true es_max_open_files: 65536 @@ -36,11 +38,5 @@ es_api_host: "localhost" es_api_port: 9200 es_debian_startup_timeout: 10 -# Since ansible 2.2 the following variables need to be defined -# to allow the role to be conditionally played with a when condition. -pid_dir: '' -log_dir: '' -conf_dir: '' -data_dirs: '' # JVM custom parameters es_jvm_custom_parameters: '' diff --git a/handlers/main.yml b/handlers/main.yml index d71397a..200fd67 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -7,7 +7,7 @@ - name: restart elasticsearch become: yes - service: name={{instance_init_script | basename}} state=restarted enabled=yes + service: name=elasticsearch state=restarted enabled=yes when: - es_restart_on_change - es_start_service diff --git a/tasks/elasticsearch-Debian.yml b/tasks/elasticsearch-Debian.yml index 037ea23..3b696c7 100644 --- a/tasks/elasticsearch-Debian.yml +++ b/tasks/elasticsearch-Debian.yml @@ -19,7 +19,7 @@ - name: stop elasticsearch service: - name: '{{ instance_init_script | basename }}' + name: 'elasticsearch' state: stopped when: elasticsearch_package.stdout == 'install ok installed' diff --git a/tasks/elasticsearch-config.yml b/tasks/elasticsearch-config.yml index b6cd067..3d4f304 100644 --- a/tasks/elasticsearch-config.yml +++ b/tasks/elasticsearch-config.yml @@ -6,124 +6,31 @@ become: yes file: path={{ item }} state=directory owner={{ es_user }} group={{ es_group }} with_items: - - "{{pid_dir}}" - - "{{log_dir}}" - - "{{conf_dir}}" - -- name: Create Data Directories - become: yes - file: path={{ item }} state=directory owner={{ es_user }} group={{ es_group }} - with_items: - - "{{data_dirs}}" + - "{{ es_pid_dir }}" + - "{{ es_log_dir }}" + - "{{ es_conf_dir }}" + - "{{ es_data_dirs }}" #Copy the config template - name: Copy Configuration File become: yes - template: src=elasticsearch.yml.j2 dest={{conf_dir}}/elasticsearch.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes + template: src=elasticsearch.yml.j2 dest={{ es_conf_dir }}/elasticsearch.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes register: system_change notify: restart elasticsearch -#Copy the instance specific default file -- name: Copy Default File for Instance +#Copy the default file +- name: Copy Default File become: yes - template: src=elasticsearch.j2 dest={{instance_default_file}} mode=0644 force=yes + template: src=elasticsearch.j2 dest={{ default_file }} mode=0644 force=yes notify: restart elasticsearch -#Copy the instance specific init file -- name: Copy Debian Init File for Instance - become: yes - template: src=init/debian/elasticsearch.j2 dest={{instance_init_script}} mode=0755 force=yes - when: ansible_os_family == 'Debian' and not use_system_d - notify: restart elasticsearch - -#Copy the instance specific init file -- name: Copy Redhat Init File for Instance - become: yes - template: src=init/redhat/elasticsearch.j2 dest={{instance_init_script}} mode=0755 force=yes - when: ansible_os_family == 'RedHat' and not use_system_d - notify: restart elasticsearch - -#Copy the systemd specific file if systemd is installed -- name: Copy Systemd File for Instance - become: yes - template: src=systemd/elasticsearch.j2 dest={{instance_sysd_script}} mode=0644 force=yes - when: use_system_d - notify: - - reload systemd configuration - - restart elasticsearch - #Copy the logging.yml -- name: Copy log4j2.properties File for Instance +- name: Copy log4j2.properties File become: yes - template: src={{es_config_log4j2}} dest={{conf_dir}}/log4j2.properties owner={{ es_user }} group={{ es_group }} mode=0644 force=yes + template: src={{es_config_log4j2}} dest={{ es_conf_dir }}/log4j2.properties owner={{ es_user }} group={{ es_group }} mode=0644 force=yes notify: restart elasticsearch -- name: Copy jvm.options File for Instance +- name: Copy jvm.options File become: yes - 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={{ es_conf_dir }}/jvm.options owner={{ es_user }} group={{ es_group }} mode=0644 force=yes notify: restart elasticsearch - -#Clean up un-wanted package scripts to avoid confusion - -- name: Delete Default Init - become: yes - file: dest=/etc/init.d/elasticsearch state=absent - -- name: Create empty default environment file - become: yes - changed_when: False - copy: - dest: /etc/default/elasticsearch - content: '' - when: ansible_os_family == 'Debian' - -- name: Create empty default environment file - become: yes - changed_when: False - copy: - dest: /etc/sysconfig/elasticsearch - content: '' - when: ansible_os_family == 'RedHat' - -- name: Symlink default systemd service to first instance of elasticsearch - when: use_system_d - block: - - name: Check if default systemd file exists - stat: - path: "{{ sysd_script }}" - register: sysd_stat_result - check_mode: no - - - name: Remove if it is a normal file - become: yes - file: - path: "{{ sysd_script }}" - state: absent - when: sysd_stat_result.stat.exists and not sysd_stat_result.stat.islnk - - - name: Create a symbolic link to the default systemd location to the first instance running on this host - become: yes - file: - state: link - src: "{{ instance_sysd_script }}" - path: "{{ sysd_script }}" - when: sysd_stat_result.stat.exists and not sysd_stat_result.stat.islnk - notify: - - reload systemd configuration - - restart elasticsearch - -- name: Delete Default Configuration File - become: yes - file: dest=/etc/elasticsearch/elasticsearch.yml state=absent - -- name: Delete Default Logging File - become: yes - file: dest=/etc/elasticsearch/logging.yml state=absent - -- name: Delete Default Logging File - become: yes - file: dest=/etc/elasticsearch/log4j2.properties state=absent - -- name: Delete Default JVM Options File - become: yes - file: dest=/etc/elasticsearch/jvm.options state=absent diff --git a/tasks/elasticsearch-parameters.yml b/tasks/elasticsearch-parameters.yml index 1d432c8..08af2bc 100644 --- a/tasks/elasticsearch-parameters.yml +++ b/tasks/elasticsearch-parameters.yml @@ -1,9 +1,5 @@ # Check for mandatory parameters -- name: fail when es_instance is not defined - fail: msg="es_instance_name must be specified and cannot be blank" - when: es_instance_name is not defined or es_instance_name == '' - - name: fail when es_proxy_port is not defined or is blank fail: msg="es_proxy_port must be specified and cannot be blank when es_proxy_host is defined" when: (es_proxy_port is not defined or es_proxy_port == '') and (es_proxy_host is defined and es_proxy_host != '') @@ -34,38 +30,5 @@ msg: "ERROR: INVALID CONFIG - YOU CANNOT CHANGE RESERVED USERS THROUGH THE FILE REALM. THE FOLLOWING CANNOT BE CHANGED: {{file_reserved_users}}. USE THE NATIVE REALM." when: file_reserved_users | default([]) | length > 0 -- name: set fact instance_default_file - set_fact: instance_default_file={{default_file | dirname}}/{{es_instance_name}}_{{default_file | basename}} -- name: set fact instance_init_script - set_fact: instance_init_script={{init_script | dirname }}/{{es_instance_name}}_{{init_script | basename}} -- name: set fact conf_dir - set_fact: conf_dir={{ es_conf_dir }}/{{es_instance_name}} - name: set fact m_lock_enabled set_fact: m_lock_enabled={{ es_config['bootstrap.memory_lock'] is defined and es_config['bootstrap.memory_lock'] == True }} - -#TODO - if transport.host is not local maybe error on boostrap checks - - -#Use systemd for the following distributions: -#Ubuntu 15 and up -#Debian 8 and up -#Centos 7 and up -#Relies on elasticsearch distribution installing a serviced script to determine whether one should be copied. - -- name: set fact use_system_d - set_fact: use_system_d={{(ansible_distribution == 'Debian' and ansible_distribution_version is version_compare('8', '>=')) or (ansible_distribution in ['RedHat','CentOS'] and ansible_distribution_version is version_compare('7', '>=')) or (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('15', '>=')) }} - -- name: set fact instance_sysd_script - set_fact: instance_sysd_script={{sysd_script | dirname }}/{{es_instance_name}}_{{sysd_script | basename}} - when: use_system_d -#For directories we also use the {{inventory_hostname}}-{{ es_instance_name }} - this helps if we have a shared SAN. - -- name: set fact instance_suffix - set_fact: - instance_suffix: "{{ es_instance_suffix | default([inventory_hostname, es_instance_name] | join('-')) }}" -- name: set fact pid_dir - set_fact: pid_dir={{ es_pid_dir }}/{{instance_suffix}} -- name: set fact log_dir - set_fact: log_dir={{ es_log_dir }}/{{instance_suffix}} -- name: set fact data_dirs - set_fact: data_dirs={{ es_data_dirs | append_to_list('/'+instance_suffix) }} diff --git a/tasks/elasticsearch-plugins.yml b/tasks/elasticsearch-plugins.yml index 5aafade..b0a300d 100644 --- a/tasks/elasticsearch-plugins.yml +++ b/tasks/elasticsearch-plugins.yml @@ -27,9 +27,9 @@ changed_when: False ignore_errors: yes environment: - CONF_DIR: "{{ conf_dir }}" - ES_PATH_CONF: "{{ conf_dir }}" - ES_INCLUDE: "{{ instance_default_file }}" + CONF_DIR: "{{ es_conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" + ES_INCLUDE: "{{ default_file }}" check_mode: no #if es_plugins_reinstall is set to true we remove ALL plugins @@ -60,9 +60,9 @@ notify: restart elasticsearch register: plugin_removed environment: - CONF_DIR: "{{ conf_dir }}" - ES_PATH_CONF: "{{ conf_dir }}" - ES_INCLUDE: "{{ instance_default_file }}" + CONF_DIR: "{{ es_conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" + ES_INCLUDE: "{{ default_file }}" - name: Install elasticsearch plugins become: yes @@ -73,9 +73,9 @@ when: item.plugin in plugins_to_install notify: restart elasticsearch environment: - CONF_DIR: "{{ conf_dir }}" - ES_PATH_CONF: "{{ conf_dir }}" - ES_INCLUDE: "{{ instance_default_file }}" + CONF_DIR: "{{ es_conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" + ES_INCLUDE: "{{ default_file }}" ES_JAVA_OPTS: "{% if item.proxy_host is defined and item.proxy_host != '' and item.proxy_port is defined and item.proxy_port != ''%} -Dhttp.proxyHost={{ item.proxy_host }} -Dhttp.proxyPort={{ item.proxy_port }} -Dhttps.proxyHost={{ item.proxy_host }} -Dhttps.proxyPort={{ item.proxy_port }} {% elif es_proxy_host is defined and es_proxy_host != '' %} -Dhttp.proxyHost={{ es_proxy_host }} -Dhttp.proxyPort={{ es_proxy_port }} -Dhttps.proxyHost={{ es_proxy_host }} -Dhttps.proxyPort={{ es_proxy_port }} {% endif %}" until: plugin_installed.rc == 0 retries: 5 diff --git a/tasks/main.yml b/tasks/main.yml index 6a622bb..c41ab6e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -56,7 +56,7 @@ - name: Make sure elasticsearch is started become: yes - service: name={{instance_init_script | basename}} state=started enabled=yes + service: name=elasticsearch state=started enabled=yes when: es_start_service - name: Wait for elasticsearch to startup diff --git a/tasks/xpack/elasticsearch-xpack-install.yml b/tasks/xpack/elasticsearch-xpack-install.yml index 522f816..421a475 100644 --- a/tasks/xpack/elasticsearch-xpack-install.yml +++ b/tasks/xpack/elasticsearch-xpack-install.yml @@ -10,9 +10,9 @@ check_mode: no ignore_errors: yes environment: - CONF_DIR: "{{ conf_dir }}" - ES_PATH_CONF: "{{ conf_dir }}" - ES_INCLUDE: "{{ instance_default_file }}" + CONF_DIR: "{{ es_conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" + ES_INCLUDE: "{{ default_file }}" #Remove X-Pack if installed and its not been requested or the ES version has changed @@ -25,9 +25,9 @@ when: x_pack_installed.rc == 0 and (not es_enable_xpack or es_version_changed) notify: restart elasticsearch environment: - CONF_DIR: "{{ conf_dir }}" - ES_PATH_CONF: "{{ conf_dir }}" - ES_INCLUDE: "{{ instance_default_file }}" + CONF_DIR: "{{ es_conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" + ES_INCLUDE: "{{ default_file }}" #Install plugin if not installed, or the es version has changed (so removed above), and its been requested @@ -44,9 +44,9 @@ when: (x_pack_installed.rc == 1 or es_version_changed) and (es_enable_xpack and es_xpack_custom_url is defined) notify: restart elasticsearch environment: - CONF_DIR: "{{ conf_dir }}" - ES_PATH_CONF: "{{ conf_dir }}" - ES_INCLUDE: "{{ instance_default_file }}" + CONF_DIR: "{{ es_conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" + ES_INCLUDE: "{{ default_file }}" - name: Delete x-pack zip file file: dest=/tmp/x-pack-{{ es_version }}.zip state=absent @@ -62,7 +62,7 @@ when: (x_pack_installed.rc == 1 or es_version_changed) and (es_enable_xpack and es_xpack_custom_url is not defined) notify: restart elasticsearch environment: - CONF_DIR: "{{ conf_dir }}" - ES_PATH_CONF: "{{ conf_dir }}" - ES_INCLUDE: "{{ instance_default_file }}" + CONF_DIR: "{{ es_conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" + ES_INCLUDE: "{{ default_file }}" ES_JAVA_OPTS: "{% if es_proxy_host is defined and es_proxy_host != '' %}-Dhttp.proxyHost={{ es_proxy_host }} -Dhttp.proxyPort={{ es_proxy_port }} -Dhttps.proxyHost={{ es_proxy_host }} -Dhttps.proxyPort={{ es_proxy_port }}{% endif %}" diff --git a/tasks/xpack/elasticsearch-xpack.yml b/tasks/xpack/elasticsearch-xpack.yml index 607343b..3347bd4 100644 --- a/tasks/xpack/elasticsearch-xpack.yml +++ b/tasks/xpack/elasticsearch-xpack.yml @@ -20,5 +20,5 @@ #Make sure elasticsearch.keystore has correct Permissions - name: Set elasticsearch.keystore Permissions become: yes - file: state=file path={{ conf_dir }}/elasticsearch.keystore owner={{ es_user }} group={{ es_group }} + file: state=file path={{ es_conf_dir }}/elasticsearch.keystore owner={{ es_user }} group={{ es_group }} when: es_enable_xpack diff --git a/tasks/xpack/security/elasticsearch-security-file.yml b/tasks/xpack/security/elasticsearch-security-file.yml index 0debff1..fe14bab 100644 --- a/tasks/xpack/security/elasticsearch-security-file.yml +++ b/tasks/xpack/security/elasticsearch-security-file.yml @@ -4,7 +4,7 @@ - name: Check if old users file exists stat: - path: '{{ conf_dir }}/x-pack/users' + path: '{{ es_conf_dir }}/x-pack/users' register: old_users_file check_mode: no @@ -12,14 +12,14 @@ copy: remote_src: yes force: no # only copy it if the new path doesn't exist yet - src: "{{ conf_dir }}/x-pack/users" - dest: "{{ conf_dir }}{{ es_xpack_conf_subdir }}/users" + src: "{{ es_conf_dir }}/x-pack/users" + dest: "{{ es_conf_dir }}{{ es_xpack_conf_subdir }}/users" when: old_users_file.stat.exists - name: Create the users file if it doesn't exist copy: content: "" - dest: "{{ conf_dir }}{{ es_xpack_conf_subdir }}/users" + dest: "{{ es_conf_dir }}{{ es_xpack_conf_subdir }}/users" force: no # this ensures it only creates it if it does not exist group: "{{ es_group }}" owner: "{{ es_user }}" @@ -28,7 +28,7 @@ #List current users - name: List Users become: yes - shell: cat {{conf_dir}}{{es_xpack_conf_subdir}}/users | awk -F':' '{print $1}' + shell: cat {{ es_conf_dir }}{{es_xpack_conf_subdir}}/users | awk -F':' '{print $1}' register: current_file_users when: manage_file_users changed_when: False @@ -46,8 +46,8 @@ with_items: "{{users_to_remove | default([])}}" when: manage_file_users environment: - CONF_DIR: "{{ conf_dir }}" - ES_PATH_CONF: "{{ conf_dir }}" + CONF_DIR: "{{ es_conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" ES_HOME: "{{es_home}}" - name: set fact users_to_add @@ -63,8 +63,8 @@ when: manage_file_users no_log: True environment: - CONF_DIR: "{{ conf_dir }}" - ES_PATH_CONF: "{{ conf_dir }}" + CONF_DIR: "{{ es_conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" ES_HOME: "{{es_home}}" #Set passwords for all users declared - Required as the useradd will not change existing user passwords @@ -78,8 +78,8 @@ changed_when: False no_log: True environment: - CONF_DIR: "{{ conf_dir }}" - ES_PATH_CONF: "{{ conf_dir }}" + CONF_DIR: "{{ es_conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" ES_HOME: "{{es_home}}" - name: set fact users_roles @@ -89,16 +89,16 @@ #Copy Roles files - name: Copy roles.yml File for Instance become: yes - template: src=security/roles.yml.j2 dest={{conf_dir}}{{es_xpack_conf_subdir}}/roles.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes + template: src=security/roles.yml.j2 dest={{ es_conf_dir }}{{es_xpack_conf_subdir}}/roles.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes when: es_roles is defined and es_roles.file is defined #Overwrite users_roles file - name: Copy User Roles become: yes - template: src=security/users_roles.j2 dest={{conf_dir}}{{es_xpack_conf_subdir}}/users_roles mode=0644 force=yes + template: src=security/users_roles.j2 dest={{ es_conf_dir }}{{es_xpack_conf_subdir}}/users_roles mode=0644 force=yes when: manage_file_users and users_roles | length > 0 #Set permission on security directory. E.g. if 2 nodes are installed on the same machine, the second node will not get the users file created at install, causing the files being created at es_users call and then having the wrong Permissions. - name: Set Security Directory Permissions Recursive become: yes - file: state=directory path={{conf_dir}}{{es_xpack_conf_subdir}}/ owner={{ es_user }} group={{ es_group }} recurse=yes + file: state=directory path={{ es_conf_dir }}{{es_xpack_conf_subdir}}/ owner={{ es_user }} group={{ es_group }} recurse=yes diff --git a/tasks/xpack/security/elasticsearch-security.yml b/tasks/xpack/security/elasticsearch-security.yml index 32e1b97..2c18019 100644 --- a/tasks/xpack/security/elasticsearch-security.yml +++ b/tasks/xpack/security/elasticsearch-security.yml @@ -5,7 +5,7 @@ #Ensure x-pack conf directory is created if necessary - name: Ensure x-pack conf directory exists (file) - file: path={{ conf_dir }}{{ es_xpack_conf_subdir }} state=directory owner={{ es_user }} group={{ es_group }} + file: path={{ es_conf_dir }}{{ es_xpack_conf_subdir }} state=directory owner={{ es_user }} group={{ es_group }} changed_when: False when: (es_users is defined and es_users.file is defined) or (es_roles is defined and es_roles.file is defined) or (es_role_mapping is defined) @@ -18,9 +18,9 @@ command: > {{es_home}}/bin/elasticsearch-keystore create args: - creates: "{{ conf_dir }}/elasticsearch.keystore" + creates: "{{ es_conf_dir }}/elasticsearch.keystore" environment: - ES_PATH_CONF: "{{ conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" - name: Check if bootstrap password is set become: yes @@ -29,7 +29,7 @@ register: list_keystore changed_when: False environment: - ES_PATH_CONF: "{{ conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" check_mode: no - name: Create Bootstrap password for elastic user @@ -38,7 +38,7 @@ when: - es_api_basic_auth_username is defined and list_keystore is defined and es_api_basic_auth_username == 'elastic' and 'bootstrap.password' not in list_keystore.stdout_lines environment: - ES_PATH_CONF: "{{ conf_dir }}" + ES_PATH_CONF: "{{ es_conf_dir }}" no_log: true ### END BLOCK elasticsearch keystore ### @@ -52,7 +52,7 @@ #Copy Roles files - name: Copy role_mapping.yml File for Instance become: yes - template: src=security/role_mapping.yml.j2 dest={{conf_dir}}{{es_xpack_conf_subdir}}/role_mapping.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes + template: src=security/role_mapping.yml.j2 dest={{ es_conf_dir }}{{es_xpack_conf_subdir}}/role_mapping.yml owner={{ es_user }} group={{ es_group }} mode=0644 force=yes when: es_role_mapping is defined #------------------------------------------------------------------------------------ @@ -60,5 +60,5 @@ #Ensure security conf directory is created - name: Ensure security conf directory exists become: yes - file: path={{ conf_dir }}/security state=directory owner={{ es_user }} group={{ es_group }} + file: path={{ es_conf_dir }}/security state=directory owner={{ es_user }} group={{ es_group }} changed_when: False diff --git a/tasks/xpack/security/elasticsearch-xpack-activation.yml b/tasks/xpack/security/elasticsearch-xpack-activation.yml index 2bce5bb..996d86a 100644 --- a/tasks/xpack/security/elasticsearch-xpack-activation.yml +++ b/tasks/xpack/security/elasticsearch-xpack-activation.yml @@ -1,33 +1,15 @@ --- - -- name: Activate ES license (without security authentication) - uri: - method: PUT - url: "http://{{es_api_host}}:{{es_api_port}}/_xpack/license?acknowledge=true" - body_format: json - body: "{{ es_xpack_license }}" - return_content: yes - register: license_activated - no_log: True - when: es_api_basic_auth_username is not defined or es_api_basic_auth_password is not defined - failed_when: > - license_activated.status != 200 or - license_activated.json.license_status is not defined or - license_activated.json.license_status != 'valid' - - name: Activate ES license (with security authentication) uri: method: PUT url: "http://{{es_api_host}}:{{es_api_port}}/_xpack/license?acknowledge=true" - user: "{{es_api_basic_auth_username}}" - password: "{{es_api_basic_auth_password}}" + user: "{{es_api_basic_auth_username | default(omit)}}" + password: "{{es_api_basic_auth_password | default(omit)}}" body_format: json - force_basic_auth: yes body: "{{ es_xpack_license }}" return_content: yes register: license_activated no_log: True - when: es_api_basic_auth_username is defined and es_api_basic_auth_password is defined failed_when: > license_activated.status != 200 or license_activated.json.license_status is not defined or diff --git a/templates/elasticsearch.j2 b/templates/elasticsearch.j2 index 5bf5746..912cc38 100644 --- a/templates/elasticsearch.j2 +++ b/templates/elasticsearch.j2 @@ -9,19 +9,19 @@ ES_HOME={{es_home}} #JAVA_HOME= # Elasticsearch configuration directory -CONF_DIR={{conf_dir}} -ES_PATH_CONF={{conf_dir}} +CONF_DIR={{ es_conf_dir }} +ES_PATH_CONF={{ es_conf_dir }} # Elasticsearch data directory -DATA_DIR={{ data_dirs | array_to_str }} +DATA_DIR={{ es_data_dirs | array_to_str }} # Elasticsearch logs directory -LOG_DIR={{log_dir}} +LOG_DIR={{ es_log_dir }} # Elasticsearch PID directory -PID_DIR={{pid_dir}} +PID_DIR={{ es_pid_dir }} -ES_JVM_OPTIONS={{conf_dir}}/jvm.options +ES_JVM_OPTIONS={{ es_conf_dir }}/jvm.options # Configure restart on package upgrade (true, every other setting will lead to not restarting) #ES_RESTART_ON_UPGRADE=true @@ -33,16 +33,6 @@ ES_JVM_OPTIONS={{conf_dir}}/jvm.options # Elasticsearch service ################################ -# SysV init.d -# -# When executing the init script, this user will be used to run the elasticsearch service. -# The default value is 'elasticsearch' and is declared in the init.d file. -# Note that this setting is only used by the init script. If changed, make sure that -# the configured user can read and write into the data, work, plugins and log directories. -# For systemd service, the user is usually configured in file /usr/lib/systemd/system/elasticsearch.service -ES_USER={{es_user}} -ES_GROUP={{es_group}} - # The number of seconds to wait before checking if Elasticsearch started successfully as a daemon process ES_STARTUP_SLEEP_TIME=5 diff --git a/templates/elasticsearch.yml.j2 b/templates/elasticsearch.yml.j2 index f7ecae0..47346ed 100644 --- a/templates/elasticsearch.yml.j2 +++ b/templates/elasticsearch.yml.j2 @@ -8,7 +8,7 @@ cluster.name: elasticsearch {% endif %} {% if es_config['node.name'] is not defined %} -node.name: {{inventory_hostname}}-{{es_instance_name}} +node.name: {{inventory_hostname}} {% endif %} #################################### Paths #################################### @@ -16,12 +16,12 @@ node.name: {{inventory_hostname}}-{{es_instance_name}} # Path to directory containing configuration (this file and logging.yml): {% if (es_version is version_compare('6.0.0', '<')) %} -path.conf: {{ conf_dir }} +path.conf: {{ es_conf_dir }} {% endif %} -path.data: {{ data_dirs | array_to_str }} +path.data: {{ es_data_dirs | array_to_str }} -path.logs: {{ log_dir }} +path.logs: {{ es_log_dir }} {% if es_path_repo is defined %} path.repo: {{ es_path_repo }} diff --git a/templates/init/debian/elasticsearch.j2 b/templates/init/debian/elasticsearch.j2 deleted file mode 100755 index 7d7e346..0000000 --- a/templates/init/debian/elasticsearch.j2 +++ /dev/null @@ -1,229 +0,0 @@ -#!/bin/bash -# -# /etc/init.d/elasticsearch -- startup script for Elasticsearch -# -### BEGIN INIT INFO -# Provides: elasticsearch -# Required-Start: $network $remote_fs $named -# Required-Stop: $network $remote_fs $named -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Starts elasticsearch -# Description: Starts elasticsearch using start-stop-daemon -### END INIT INFO - -PATH=/bin:/usr/bin:/sbin:/usr/sbin -NAME={{es_instance_name}}_{{default_file | basename}} -{% if es_config['node.name'] is defined %} -DESC="Elasticsearch Server - {{es_config['node.name']}}" -{% else %} -DESC="Elasticsearch Server - {{es_instance_name}}" -{% endif %} - -DEFAULT=/etc/default/$NAME - -if [ `id -u` -ne 0 ]; then - echo "You need root privileges to run this script" - exit 1 -fi - -. /lib/lsb/init-functions -if [ -r /etc/default/rcS ]; then - . /etc/default/rcS -fi - -# The following variables can be overwritten in $DEFAULT - -# Run Elasticsearch as this user ID and group ID -ES_USER={{es_user}} -ES_GROUP={{es_group}} - -# Directory where the Elasticsearch binary distribution resides -ES_HOME={{es_home}} - -# Maximum number of open files -{% if es_max_open_files is defined %} -MAX_OPEN_FILES={{es_max_open_files}} -{% endif %} - -# Maximum amount of locked memory -#MAX_LOCKED_MEMORY= -{% if m_lock_enabled %} -MAX_LOCKED_MEMORY=unlimited -{% endif %} - -# Elasticsearch log directory -LOG_DIR={{log_dir}} - -# Elasticsearch data directory -DATA_DIR={{ data_dirs | array_to_str }} - -# Elasticsearch configuration directory -CONF_DIR={{conf_dir}} -ES_PATH_CONF={{ conf_dir }} - -# Maximum number of VMA (Virtual Memory Areas) a process can own -{% if es_max_map_count is defined %} -MAX_MAP_COUNT={{es_max_map_count}} -{% endif %} - -# Elasticsearch PID file directory -PID_DIR={{pid_dir}} - -ES_JVM_OPTIONS="{{conf_dir}}/jvm.options" - -# End of variables that can be overwritten in $DEFAULT - -# overwrite settings from default file -if [ -f "$DEFAULT" ]; then - . "$DEFAULT" -fi - -# CONF_FILE setting was removed -if [ ! -z "$CONF_FILE" ]; then - echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed." - exit 1 -fi - -if [ "$ES_USER" != "elasticsearch" ] || [ "$ES_GROUP" != "elasticsearch" ]; then - echo "WARNING: ES_USER and ES_GROUP are deprecated and will be removed in the next major version of Elasticsearch, got: [$ES_USER:$ES_GROUP]" -fi - -# Define other required variables -PID_FILE="$PID_DIR/$NAME.pid" -DAEMON=$ES_HOME/bin/elasticsearch -{% if (es_version is version_compare('6.0.0', '<')) %} -DAEMON_OPTS="-d -p $PID_FILE -Edefault.path.logs=$LOG_DIR -Edefault.path.data=$DATA_DIR -Edefault.path.conf=$CONF_DIR" -{% else %} -DAEMON_OPTS="-d -p $PID_FILE" -{% endif %} - -export ES_JAVA_OPTS -export JAVA_HOME -export ES_INCLUDE -export ES_JVM_OPTIONS -export ES_PATH_CONF - -# export unsupported variables so bin/elasticsearch can reject them and inform the user these are unsupported -if test -n "$ES_MIN_MEM"; then export ES_MIN_MEM; fi -if test -n "$ES_MAX_MEM"; then export ES_MAX_MEM; fi -if test -n "$ES_HEAP_SIZE"; then export ES_HEAP_SIZE; fi -if test -n "$ES_HEAP_NEWSIZE"; then export ES_HEAP_NEWSIZE; fi -if test -n "$ES_DIRECT_SIZE"; then export ES_DIRECT_SIZE; fi -if test -n "$ES_USE_IPV4"; then export ES_USE_IPV4; fi -if test -n "$ES_GC_OPTS"; then export ES_GC_OPTS; fi -if test -n "$ES_GC_LOG_FILE"; then export ES_GC_LOG_FILE; fi - -# Check DAEMON exists -if [ ! -x "$DAEMON" ]; then - echo "The elasticsearch startup script does not exists or it is not executable, tried: $DAEMON" - exit 1 -fi - -checkJava() { - if [ -x "$JAVA_HOME/bin/java" ]; then - JAVA="$JAVA_HOME/bin/java" - else - JAVA=`which java` - fi - - if [ ! -x "$JAVA" ]; then - echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME" - exit 1 - fi -} - -case "$1" in - start) - checkJava - - log_daemon_msg "Starting $DESC" - - pid=`pidofproc -p $PID_FILE elasticsearch` - if [ -n "$pid" ] ; then - log_begin_msg "Already running." - log_end_msg 0 - exit 0 - fi - - # Ensure that the PID_DIR exists (it is cleaned at OS startup time) - if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then - mkdir -p "$PID_DIR" && chown "$ES_USER":"$ES_GROUP" "$PID_DIR" - fi - if [ -n "$PID_FILE" ] && [ ! -e "$PID_FILE" ]; then - touch "$PID_FILE" && chown "$ES_USER":"$ES_GROUP" "$PID_FILE" - fi - - if [ -n "$MAX_OPEN_FILES" ]; then - ulimit -n $MAX_OPEN_FILES - fi - - if [ -n "$MAX_LOCKED_MEMORY" ]; then - ulimit -l $MAX_LOCKED_MEMORY - fi - - if [ -n "$MAX_THREADS" ]; then - ulimit -u $MAX_THREADS - fi - - if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then - sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT - fi - - # Start Daemon - start-stop-daemon -d $ES_HOME --start --user "$ES_USER" -c "$ES_USER" --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS - return=$? - if [ $return -eq 0 ]; then - i=0 - timeout={{es_debian_startup_timeout}} - # Wait for the process to be properly started before exiting - until { kill -0 `cat "$PID_FILE"`; } >/dev/null 2>&1 - do - sleep 1 - i=$(($i + 1)) - if [ $i -gt $timeout ]; then - log_end_msg 1 - exit 1 - fi - done - fi - log_end_msg $return - exit $return - ;; - stop) - log_daemon_msg "Stopping $DESC" - - if [ -f "$PID_FILE" ]; then - start-stop-daemon --stop --pidfile "$PID_FILE" \ - --user "$ES_USER" \ - --quiet \ - --retry forever/TERM/20 > /dev/null - if [ $? -eq 1 ]; then - log_progress_msg "$DESC is not running but pid file exists, cleaning up" - elif [ $? -eq 3 ]; then - PID="`cat $PID_FILE`" - log_failure_msg "Failed to stop $DESC (pid $PID)" - exit 1 - fi - rm -f "$PID_FILE" - else - log_progress_msg "(not running)" - fi - log_end_msg 0 - ;; - status) - status_of_proc -p $PID_FILE elasticsearch elasticsearch && exit 0 || exit $? - ;; - restart|force-reload) - if [ -f "$PID_FILE" ]; then - $0 stop - fi - $0 start - ;; - *) - log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}" - exit 1 - ;; -esac - -exit 0 diff --git a/templates/init/redhat/elasticsearch.j2 b/templates/init/redhat/elasticsearch.j2 deleted file mode 100755 index 8ba1164..0000000 --- a/templates/init/redhat/elasticsearch.j2 +++ /dev/null @@ -1,217 +0,0 @@ -#!/bin/bash -# -# elasticsearch -# -# chkconfig: 2345 80 20 -# description: Starts and stops a single elasticsearch instance on this system -# - -### BEGIN INIT INFO -# Provides: Elasticsearch -# Required-Start: $network $named -# Required-Stop: $network $named -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: This service manages the elasticsearch daemon -# Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search. -### END INIT INFO - -# -# init.d / servicectl compatibility (openSUSE) -# -if [ -f /etc/rc.status ]; then - . /etc/rc.status - rc_reset -fi - -# -# Source function library. -# -if [ -f /etc/rc.d/init.d/functions ]; then - . /etc/rc.d/init.d/functions -fi - -# Sets the default values for elasticsearch variables used in this script -ES_USER="{{es_user}}" -ES_GROUP="{{es_group}}" -ES_HOME="{{es_home}}" -{% if es_max_open_files is defined %} -MAX_OPEN_FILES={{es_max_open_files}} -{% endif %} -# Maximum number of VMA (Virtual Memory Areas) a process can own -{% if es_max_map_count is defined %} -MAX_MAP_COUNT={{es_max_map_count}} -{% endif %} - -LOG_DIR="{{log_dir}}" -DATA_DIR={{ data_dirs | array_to_str }} -CONF_DIR="{{conf_dir}}" -ES_PATH_CONF="{{ conf_dir }}" - -PID_DIR="{{pid_dir}}" - -# Source the default env file -ES_ENV_FILE="{{instance_default_file}}" -if [ -f "$ES_ENV_FILE" ]; then - . "$ES_ENV_FILE" -fi - -if [ "$ES_USER" != "elasticsearch" ] || [ "$ES_GROUP" != "elasticsearch" ]; then - echo "WARNING: ES_USER and ES_GROUP are deprecated and will be removed in the next major version of Elasticsearch, got: [$ES_USER:$ES_GROUP]" -fi - -# CONF_FILE setting was removed -if [ ! -z "$CONF_FILE" ]; then - echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed." - exit 1 -fi - -exec="$ES_HOME/bin/elasticsearch" -prog="{{es_instance_name}}_{{default_file | basename}}" -pidfile="$PID_DIR/${prog}.pid" - -export ES_JAVA_OPTS -export JAVA_HOME -export ES_INCLUDE -export ES_JVM_OPTIONS -export ES_STARTUP_SLEEP_TIME -export ES_PATH_CONF - -# export unsupported variables so bin/elasticsearch can reject them and inform the user these are unsupported -if test -n "$ES_MIN_MEM"; then export ES_MIN_MEM; fi -if test -n "$ES_MAX_MEM"; then export ES_MAX_MEM; fi -if test -n "$ES_HEAP_SIZE"; then export ES_HEAP_SIZE; fi -if test -n "$ES_HEAP_NEWSIZE"; then export ES_HEAP_NEWSIZE; fi -if test -n "$ES_DIRECT_SIZE"; then export ES_DIRECT_SIZE; fi -if test -n "$ES_USE_IPV4"; then export ES_USE_IPV4; fi -if test -n "$ES_GC_OPTS"; then export ES_GC_OPTS; fi -if test -n "$ES_GC_LOG_FILE"; then export ES_GC_LOG_FILE; fi - -lockfile=/var/lock/subsys/$prog - -# backwards compatibility for old config sysconfig files, pre 0.90.1 -if [ -n $USER ] && [ -z $ES_USER ] ; then - ES_USER=$USER -fi - -if [ ! -x "$exec" ]; then - echo "The elasticsearch startup script does not exists or it is not executable, tried: $exec" - exit 1 -fi - -checkJava() { - if [ -x "$JAVA_HOME/bin/java" ]; then - JAVA="$JAVA_HOME/bin/java" - else - JAVA=`which java` - fi - - if [ ! -x "$JAVA" ]; then - echo "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME" - exit 1 - fi -} - -start() { - checkJava - [ -x $exec ] || exit 5 - - if [ -n "$MAX_OPEN_FILES" ]; then - ulimit -n $MAX_OPEN_FILES - fi - if [ -n "$MAX_LOCKED_MEMORY" ]; then - ulimit -l $MAX_LOCKED_MEMORY - fi - if [ -n "$MAX_THREADS" ]; then - ulimit -u $MAX_THREADS - fi - if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then - sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT - fi - - # Ensure that the PID_DIR exists (it is cleaned at OS startup time) - if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then - mkdir -p "$PID_DIR" && chown "$ES_USER":"$ES_GROUP" "$PID_DIR" - fi - if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then - touch "$pidfile" && chown "$ES_USER":"$ES_GROUP" "$pidfile" - fi - - cd $ES_HOME - echo -n $"Starting $prog: " - # if not running, start it up here, usually something like "daemon $exec" -{% if (es_version is version_compare('6.0.0', '<')) %} - daemon --user $ES_USER --pidfile $pidfile $exec -p $pidfile -d -Edefault.path.logs=$LOG_DIR -Edefault.path.data=$DATA_DIR -Edefault.path.conf=$CONF_DIR -{% else %} - daemon --user $ES_USER --pidfile $pidfile $exec -p $pidfile -d -{% endif %} - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop() { - echo -n $"Stopping $prog: " - # stop it here, often "killproc $prog" - killproc -p $pidfile -d 86400 $prog - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - # run checks to determine if the service is running or use generic status - status -p $pidfile $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 2 -esac -exit $? diff --git a/templates/systemd/elasticsearch.j2 b/templates/systemd/elasticsearch.j2 deleted file mode 100644 index cd7366b..0000000 --- a/templates/systemd/elasticsearch.j2 +++ /dev/null @@ -1,78 +0,0 @@ -[Unit] -Description=Elasticsearch-{{es_instance_name}} -Documentation=http://www.elastic.co -Wants=network-online.target -After=network-online.target -{# Directive 'WorkingDirectory' creates an implicit dependecy for {{es_home}}, so it can be omitted here #} -RequiresMountsFor={{ data_dirs | array_to_str(separator=' ') }} {{log_dir}} {{pid_dir}} {{conf_dir}} - -[Service] -Environment=ES_HOME={{es_home}} -Environment=CONF_DIR={{conf_dir}} -Environment=ES_PATH_CONF={{conf_dir}} -Environment=DATA_DIR={{ data_dirs | array_to_str }} -Environment=LOG_DIR={{log_dir}} -Environment=PID_DIR={{pid_dir}} -EnvironmentFile=-{{instance_default_file}} - -WorkingDirectory={{es_home}} - -User={{es_user}} -Group={{es_group}} - -{% if (es_version is version_compare('6.0.0', '<')) %} -ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec -{% endif %} - -ExecStart={{es_home}}/bin/elasticsearch \ - -p ${PID_DIR}/elasticsearch.pid \ -{% if (es_version is version_compare('6.0.0', '<')) %} - -Edefault.path.logs=${LOG_DIR} \ - -Edefault.path.data=${DATA_DIR} \ - -Edefault.path.conf=${CONF_DIR} \ -{% endif %} - --quiet - - -# StandardOutput is configured to redirect to journalctl since -# some error messages may be logged in standard output before -# elasticsearch logging system is initialized. Elasticsearch -# stores its logs in /var/log/elasticsearch and does not use -# journalctl by default. If you also want to enable journalctl -# logging, you can simply remove the "quiet" option from ExecStart. -StandardOutput=journal -StandardError=inherit - -# Specifies the maximum file descriptor number that can be opened by this process -{% if es_max_open_files is defined %} -LimitNOFILE={{es_max_open_files}} -{% endif %} - -# Specifies the maximum number of bytes of memory that may be locked into RAM -# Set to "infinity" if you use the 'bootstrap.memory_lock: true' option -# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in {{instance_default_file}} -{% if m_lock_enabled %} -LimitMEMLOCK=infinity -{% endif %} - -# Specifies the maximum number of threads that can be started. Elasticsearch requires a -# minimum of 2048. -LimitNPROC={{ es_max_threads }} - -# Disable timeout logic and wait until process is stopped -TimeoutStopSec=0 - -# SIGTERM signal is used to stop the Java process -KillSignal=SIGTERM - -# Send the signal only to the JVM rather than its control group -KillMode=process - -# Java process is never killed -SendSIGKILL=no - -# When a JVM receives a SIGTERM signal it exits with code 143 -SuccessExitStatus=143 - -[Install] -WantedBy=multi-user.target diff --git a/test/integration/helpers/serverspec/multi_spec.rb b/test/integration/helpers/serverspec/multi_spec.rb deleted file mode 100644 index 3f42e2f..0000000 --- a/test/integration/helpers/serverspec/multi_spec.rb +++ /dev/null @@ -1,122 +0,0 @@ -require 'spec_helper' -require 'json' -vars = JSON.parse(File.read('/tmp/vars.json')) - -shared_examples 'multi::init' do |vars| - - describe service('master_elasticsearch') do - it { should be_running } - end - #test configuration parameters have been set - test all appropriately set in config file - describe file("/etc/elasticsearch/#{vars['es_instance_name']}/elasticsearch.yml") do - it { should be_file } - it { should contain 'http.port: 9201' } - if vars['es_major_version'] == '7.x' - it { should contain 'transport.port: 9301' } - else - it { should contain 'transport.tcp.port: 9301' } - end - it { should_not contain 'bootstrap.memory_lock: true' } - end - - - #test configuration parameters have been set for master - test all appropriately set in config file - describe file('/etc/elasticsearch/master/elasticsearch.yml') do - it { should be_file } - it { should contain 'http.port: 9200' } - if vars['es_major_version'] == '7.x' - it { should contain 'transport.port: 9300' } - else - it { should contain 'transport.tcp.port: 9300' } - end - it { should contain 'node.data: false' } - it { should contain 'node.master: true' } - it { should contain 'node.name: localhost-master' } - it { should contain 'bootstrap.memory_lock: true' } - it { should_not contain 'path.conf: /etc/elasticsearch/master' } - it { should contain 'path.data: /opt/elasticsearch/master/localhost-master' } - it { should contain 'path.logs: /var/log/elasticsearch/localhost-master' } - end - - describe 'Master listening' do - it 'listening in port 9200' do - expect(port 9200).to be_listening - end - end - - #test we started on the correct port was used for master - describe 'master started' do - it 'master node should be running', :retry => 3, :retry_wait => 10 do - expect(curl_json('http://localhost:9200')['name']).to eq('localhost-master') - end - end - - #test we started on the correct port was used for node 1 - describe "#{vars['es_instance_name']} started" do - it 'node should be running', :retry => 3, :retry_wait => 10 do - expect(curl_json('http://localhost:9201')['name']).to eq("localhost-#{vars['es_instance_name']}") - end - end - - #Confirm that the data directory has only been set for the first node - describe file('/opt/elasticsearch/master/localhost-master') do - it { should be_directory } - it { should be_owned_by 'elasticsearch' } - end - - describe file("/opt/elasticsearch/data-1/localhost-#{vars['es_instance_name']}") do - it { should be_directory } - it { should be_owned_by 'elasticsearch' } - end - - - describe file("/opt/elasticsearch/data-2/localhost-#{vars['es_instance_name']}") do - it { should be_directory } - it { should be_owned_by 'elasticsearch' } - end - - #test to make sure mlock was applied - describe command('curl -s "localhost:9200/_nodes/localhost-master/process?pretty=true" | grep mlockall') do - its(:stdout) { should match /true/ } - its(:exit_status) { should eq 0 } - end - - #test to make sure mlock was not applied - describe command("curl -s 'localhost:9201/_nodes/localhost-#{vars['es_instance_name']}/process?pretty=true' | grep mlockall") do - its(:stdout) { should match /false/ } - its(:exit_status) { should eq 0 } - end - - describe 'version check on master' do - it 'should be reported as version '+vars['es_version'] do - command = command('curl -s localhost:9200 | grep number') - expect(command.stdout).to match(vars['es_version']) - expect(command.exit_status).to eq(0) - end - end - - describe 'version check on data' do - it 'should be reported as version '+vars['es_version'] do - command = command('curl -s localhost:9201 | grep number') - expect(command.stdout).to match(vars['es_version']) - expect(command.exit_status).to eq(0) - end - end - - for plugin in vars['es_plugins'] - plugin = plugin['plugin'] - - describe command('curl -s localhost:9200/_nodes/plugins?pretty=true | grep '+plugin) do - its(:exit_status) { should eq 0 } - end - - describe command('curl -s localhost:9201/_nodes/plugins?pretty=true | grep '+plugin) do - its(:exit_status) { should eq 0 } - end - - describe file('/usr/share/elasticsearch/plugins/'+plugin) do - it { should be_directory } - it { should be_owned_by 'elasticsearch' } - end - end -end diff --git a/test/integration/helpers/serverspec/oss_spec.rb b/test/integration/helpers/serverspec/oss_spec.rb index d8d9409..abe9df3 100644 --- a/test/integration/helpers/serverspec/oss_spec.rb +++ b/test/integration/helpers/serverspec/oss_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' shared_examples 'oss::init' do |vars| - describe file("/etc/elasticsearch/#{vars['es_instance_name']}/log4j2.properties") do + describe file("/etc/elasticsearch/log4j2.properties") do it { should be_file } it { should be_owned_by 'elasticsearch' } it { should_not contain 'CUSTOM LOG4J FILE' } end - describe file("/etc/elasticsearch/#{vars['es_instance_name']}/jvm.options") do + describe file("/etc/elasticsearch/jvm.options") do it { should be_file } it { should be_owned_by vars['es_user'] } end diff --git a/test/integration/helpers/serverspec/shared_spec.rb b/test/integration/helpers/serverspec/shared_spec.rb index 92ddfa8..cbeb2ed 100644 --- a/test/integration/helpers/serverspec/shared_spec.rb +++ b/test/integration/helpers/serverspec/shared_spec.rb @@ -97,7 +97,7 @@ shared_examples 'shared::init' do |vars| it { should be_installed } end - describe service("#{vars['es_instance_name']}_elasticsearch") do + describe service("elasticsearch") do it { should be_running } end @@ -128,22 +128,11 @@ shared_examples 'shared::init' do |vars| end end end - describe file('/etc/init.d/elasticsearch') do - it { should_not exist } - end describe file(family['defaults_path']) do its(:content) { should match '' } end - describe file('/etc/elasticsearch/elasticsearch.yml') do - it { should_not exist } - end - - describe file('/etc/elasticsearch/logging.yml') do - it { should_not exist } - end - if vars.key?('es_plugins') vars['es_plugins'].each do |plugin| name = plugin['plugin'] @@ -162,12 +151,12 @@ shared_examples 'shared::init' do |vars| end end end - describe file("/etc/elasticsearch/#{vars['es_instance_name']}/elasticsearch.yml") do - it { should contain "node.name: localhost-#{vars['es_instance_name']}" } + describe file("/etc/elasticsearch/elasticsearch.yml") do + it { should contain "node.name: localhost" } it { should contain 'cluster.name: elasticsearch' } - it { should_not contain "path.conf: /etc/elasticsearch/#{vars['es_instance_name']}" } - its(:content) { should match "path.data: #{vars['data_dirs'].join(',')}" } - its(:content) { should match "path.logs: /var/log/elasticsearch/localhost-#{vars['es_instance_name']}" } + it { should_not contain "path.conf: /etc/elasticsearch" } + its(:content) { should match "path.data: #{vars['es_data_dirs'].join(',')}" } + its(:content) { should match "path.logs: /var/log/elasticsearch" } end if vars['es_use_repository'] diff --git a/test/integration/helpers/serverspec/xpack_upgrade_spec.rb b/test/integration/helpers/serverspec/xpack_upgrade_spec.rb index 96ec36e..4223234 100644 --- a/test/integration/helpers/serverspec/xpack_upgrade_spec.rb +++ b/test/integration/helpers/serverspec/xpack_upgrade_spec.rb @@ -4,13 +4,13 @@ vars = JSON.parse(File.read('/tmp/vars.json')) shared_examples 'xpack_upgrade::init' do |vars| #Test users file, users_roles and roles.yml - describe file("/etc/elasticsearch/#{vars['es_instance_name']}#{vars['es_xpack_conf_subdir']}/users_roles") do + describe file("/etc/elasticsearch/#{vars['es_xpack_conf_subdir']}/users_roles") do it { should be_owned_by 'elasticsearch' } it { should contain 'admin:es_admin' } it { should contain 'power_user:testUser' } end - describe file("/etc/elasticsearch/#{vars['es_instance_name']}#{vars['es_xpack_conf_subdir']}/users") do + describe file("/etc/elasticsearch/#{vars['es_xpack_conf_subdir']}/users") do it { should be_owned_by 'elasticsearch' } it { should contain 'testUser:' } it { should contain 'es_admin:' } @@ -23,7 +23,7 @@ shared_examples 'xpack_upgrade::init' do |vars| end end - describe file("/etc/elasticsearch/#{vars['es_instance_name']}/elasticsearch.yml") do + describe file("/etc/elasticsearch/elasticsearch.yml") do if vars['es_major_version'] == '7.x' it { should contain 'security.authc.realms.file.file1.order: 0' } it { should contain 'security.authc.realms.native.native1.order: 1' } @@ -36,7 +36,7 @@ shared_examples 'xpack_upgrade::init' do |vars| end #Test contents of role_mapping.yml - describe file("/etc/elasticsearch/#{vars['es_instance_name']}#{vars['es_xpack_conf_subdir']}/role_mapping.yml") do + describe file("/etc/elasticsearch/#{vars['es_xpack_conf_subdir']}/role_mapping.yml") do it { should be_owned_by 'elasticsearch' } it { should contain 'power_user:' } it { should contain '- cn=admins,dc=example,dc=com' } diff --git a/test/integration/issue-test.yml b/test/integration/issue-test.yml index 5660ae6..3c5f77a 100644 --- a/test/integration/issue-test.yml +++ b/test/integration/issue-test.yml @@ -10,13 +10,11 @@ roles: - elasticsearch vars: - es_instance_name: "security_node" es_xpack_license: "{{ lookup('file', '/tmp/license.json') }}" es_config: xpack.security.authc.realms.file.file1.order: 1 xpack.security.authc.realms.native.native1.type: "native" es_heap_size: "1g" - es_enable_xpack: true es_plugins: - plugin: ingest-attachment es_xpack_features: diff --git a/test/integration/multi.yml b/test/integration/multi.yml deleted file mode 100644 index 8f1b8e0..0000000 --- a/test/integration/multi.yml +++ /dev/null @@ -1,63 +0,0 @@ ---- -# Test ability to deploy multiple instances to a machine -- name: Elasticsearch Multi test - master on 9200 - hosts: localhost - post_tasks: - - include: elasticsearch/test/integration/debug.yml - roles: - - elasticsearch - vars: - es_instance_name: "master" - es_data_dirs: - - "/opt/elasticsearch/master" - es_config_6x: - discovery.zen.ping.unicast.hosts: "localhost:9300" - http.port: 9200 - transport.tcp.port: 9300 - node.data: false - node.master: true - bootstrap.memory_lock: true - es_config_7x: - http.port: 9200 - transport.port: 9300 - node.data: false - node.master: true - bootstrap.memory_lock: true - es_config: "{{ es_config_7x if es_major_version == '7.x' else es_config_6x }}" - es_enable_xpack: false - es_templates: true - es_heap_size: "1g" - es_api_port: 9200 - es_plugins: - - plugin: ingest-attachment - -- name: Elasticsearch Multi test - data on 9201 - hosts: localhost - post_tasks: - - include: elasticsearch/test/integration/debug.yml - roles: - - elasticsearch - vars: - es_enable_xpack: false - es_templates: true - es_heap_size: "1g" - es_api_port: 9201 - es_plugins: - - plugin: ingest-attachment - es_instance_name: "node1" - es_data_dirs: - - "/opt/elasticsearch/data-1" - - "/opt/elasticsearch/data-2" - es_config_6x: - discovery.zen.ping.unicast.hosts: "localhost:9300" - http.port: 9201 - transport.tcp.port: 9301 - node.data: true - node.master: false - es_config_7x: - discovery.seed_hosts: "localhost:9300" - http.port: 9201 - transport.port: 9301 - node.data: true - node.master: false - es_config: "{{ es_config_7x if es_major_version == '7.x' else es_config_6x }}" diff --git a/test/integration/multi/multi.yml b/test/integration/multi/multi.yml deleted file mode 100644 index a3c37e1..0000000 --- a/test/integration/multi/multi.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- host: test-kitchen diff --git a/test/integration/multi/serverspec/default_spec.rb b/test/integration/multi/serverspec/default_spec.rb deleted file mode 100644 index 718b681..0000000 --- a/test/integration/multi/serverspec/default_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'multi_spec' -require 'shared_spec' -require 'json' -vars = JSON.parse(File.read('/tmp/vars.json')) - -describe 'Multi Tests' do - include_examples 'shared::init', vars - include_examples 'multi::init', vars -end \ No newline at end of file diff --git a/test/integration/oss-to-xpack-upgrade.yml b/test/integration/oss-to-xpack-upgrade.yml index 96679a6..5648ebb 100644 --- a/test/integration/oss-to-xpack-upgrade.yml +++ b/test/integration/oss-to-xpack-upgrade.yml @@ -6,7 +6,6 @@ roles: - elasticsearch vars: - es_instance_name: "node1" es_version: "{{ '7.0.0' if es_major_version == '7.x' else '6.7.1' }}" # This is set to an older version than the current default to force an upgrade es_enable_xpack: false es_heap_size: "1g" @@ -18,7 +17,6 @@ roles: - elasticsearch vars: - es_instance_name: "node1" es_enable_xpack: true es_heap_size: "1g" es_xpack_features: diff --git a/test/integration/oss-upgrade.yml b/test/integration/oss-upgrade.yml index 62c2089..b841519 100644 --- a/test/integration/oss-upgrade.yml +++ b/test/integration/oss-upgrade.yml @@ -6,7 +6,6 @@ roles: - elasticsearch vars: - es_instance_name: "node1" es_version: "{{ '7.0.0' if es_major_version == '7.x' else '6.7.1' }}" # This is set to an older version than the current default to force an upgrade es_enable_xpack: false es_heap_size: "1g" @@ -18,6 +17,5 @@ roles: - elasticsearch vars: - es_instance_name: "node1" es_enable_xpack: false es_heap_size: "1g" diff --git a/test/integration/oss.yml b/test/integration/oss.yml index 4dfdee2..f94d585 100644 --- a/test/integration/oss.yml +++ b/test/integration/oss.yml @@ -6,7 +6,6 @@ roles: - elasticsearch vars: - es_instance_name: "node1" es_enable_xpack: false es_heap_size: "1g" es_plugins: diff --git a/test/integration/xpack-upgrade.yml b/test/integration/xpack-upgrade.yml index 560a1ca..c1944fe 100644 --- a/test/integration/xpack-upgrade.yml +++ b/test/integration/xpack-upgrade.yml @@ -6,8 +6,6 @@ roles: - elasticsearch vars: - es_instance_name: "node1" - es_api_port: 9200 es_config_6x: http.port: 9200 xpack.security.authc.realms.file1.order: 0 @@ -23,7 +21,6 @@ es_templates: true es_major_version: "7.x" es_version: "{{ '7.0.0' if es_major_version == '7.x' else '6.7.1' }}" # This is set to an older version than the current default to force an upgrade - es_enable_xpack: true es_xpack_license: "{{ lookup('file', '/tmp/license.json') }}" es_plugins: - plugin: ingest-attachment @@ -119,8 +116,6 @@ roles: - elasticsearch vars: - es_api_port: 9200 - es_instance_name: "node1" es_config_6x: http.port: 9200 xpack.security.authc.realms.file1.order: 0 @@ -134,7 +129,6 @@ es_config: "{{ es_config_7x if es_major_version == '7.x' else es_config_6x }}" es_heap_size: "1g" es_templates: true - es_enable_xpack: true es_xpack_license: "{{ lookup('file', '/tmp/license.json') }}" es_plugins: - plugin: ingest-attachment diff --git a/test/integration/xpack.yml b/test/integration/xpack.yml index d3c4c36..aa02d61 100644 --- a/test/integration/xpack.yml +++ b/test/integration/xpack.yml @@ -7,10 +7,7 @@ roles: - elasticsearch vars: - es_api_port: 9200 - es_instance_name: "node1" es_config: http.port: 9200 es_xpack_custom_url: "https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-{{ es_version }}.zip" es_heap_size: 2g - es_enable_xpack: true diff --git a/test/matrix.yml b/test/matrix.yml index e27a5ac..3e4e616 100644 --- a/test/matrix.yml +++ b/test/matrix.yml @@ -14,4 +14,3 @@ TEST_TYPE: - oss-to-xpack-upgrade - xpack - xpack-upgrade - - multi diff --git a/vars/main.yml b/vars/main.yml index c4a0183..d640fc4 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,6 +1,3 @@ --- es_package_url: "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch" -es_conf_dir: "/etc/elasticsearch" -sysd_script: "/usr/lib/systemd/system/elasticsearch.service" -init_script: "/etc/init.d/elasticsearch" reserved_xpack_users: ["elastic","kibana","logstash_system"]