From bc4ee9e0f1d7f8aba2355e50f46be08f205967cb Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Mon, 21 Mar 2016 20:16:29 +0000 Subject: [PATCH 01/13] Better error handling for plugin install and test for removal of logging.yml --- README.md | 2 +- defaults/main.yml | 3 ++- tasks/elasticsearch-plugins.yml | 3 +-- test/integration/helpers/serverspec/config_spec.rb | 4 ++++ test/integration/helpers/serverspec/multi_spec.rb | 3 +++ test/integration/helpers/serverspec/package_spec.rb | 4 ++++ test/integration/helpers/serverspec/standard_spec.rb | 4 ++++ 7 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d94ecd8..98a24d0 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Ansible role for Elasticsearch. Currently this works on Debian and RedHat based * Centos 6 * Centos 7 -The latest Elasticsearch versions of 1.7.x and 2.x are actively tested. +The latest Elasticsearch versions of 1.7.x and 2.x are actively tested. **Only Ansible versions 2.x are supported.** ## Usage diff --git a/defaults/main.yml b/defaults/main.yml index 7bf9af0..c2e4a94 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -16,4 +16,5 @@ es_pid_dir: "/var/run/elasticsearch" es_data_dirs: "/var/lib/elasticsearch" es_log_dir: "/var/log/elasticsearch" es_work_dir: "/tmp/elasticsearch" -es_plugin_dir: "/usr/share/elasticsearch/plugins" \ No newline at end of file +es_plugin_dir: "/usr/share/elasticsearch/plugins" +es_proxy_port: 8080 \ No newline at end of file diff --git a/tasks/elasticsearch-plugins.yml b/tasks/elasticsearch-plugins.yml index caa7316..1240882 100644 --- a/tasks/elasticsearch-plugins.yml +++ b/tasks/elasticsearch-plugins.yml @@ -5,7 +5,6 @@ when: elasticsearch_install.changed or es_plugins is not defined or es_plugins is none - set_fact: list_command="list" - - set_fact: list_command="--list" when: es_version | version_compare('2.0', '<') @@ -40,7 +39,7 @@ {% endif %} --silent register: plugin_installed - failed_when: "'Failed to install' in plugin_installed.stderr" + failed_when: "'ERROR' in plugin_installed.stdout" changed_when: plugin_installed.rc == 0 with_items: es_plugins when: es_plugins is defined and not es_plugins is none diff --git a/test/integration/helpers/serverspec/config_spec.rb b/test/integration/helpers/serverspec/config_spec.rb index 7eeb44c..396b9c1 100644 --- a/test/integration/helpers/serverspec/config_spec.rb +++ b/test/integration/helpers/serverspec/config_spec.rb @@ -103,6 +103,10 @@ shared_examples 'config::init' do |es_version| it { should_not exist } end + describe file('/etc/elasticsearch/logging.yml') do + it { should_not exist } + end + #Init vs Systemd tests #Ubuntu 15 and up #Debian 8 and up diff --git a/test/integration/helpers/serverspec/multi_spec.rb b/test/integration/helpers/serverspec/multi_spec.rb index 1042ef6..a52bf80 100644 --- a/test/integration/helpers/serverspec/multi_spec.rb +++ b/test/integration/helpers/serverspec/multi_spec.rb @@ -225,6 +225,9 @@ shared_examples 'multi::init' do |es_version,plugins| it { should_not exist } end + describe file('/etc/elasticsearch/logging.yml') do + it { should_not exist } + end #Test server spec file has been created and modified - currently not possible as not copied for debian 8 diff --git a/test/integration/helpers/serverspec/package_spec.rb b/test/integration/helpers/serverspec/package_spec.rb index 1e4218e..2d2dbbb 100644 --- a/test/integration/helpers/serverspec/package_spec.rb +++ b/test/integration/helpers/serverspec/package_spec.rb @@ -103,5 +103,9 @@ shared_examples 'package::init' do |es_version,plugins| it { should_not exist } end + describe file('/etc/elasticsearch/logging.yml') do + it { should_not exist } + end + end diff --git a/test/integration/helpers/serverspec/standard_spec.rb b/test/integration/helpers/serverspec/standard_spec.rb index 05b8e0e..3133493 100644 --- a/test/integration/helpers/serverspec/standard_spec.rb +++ b/test/integration/helpers/serverspec/standard_spec.rb @@ -67,5 +67,9 @@ shared_examples 'standard::init' do |es_version| it { should_not exist } end + describe file('/etc/elasticsearch/logging.yml') do + it { should_not exist } + end + end From 9b916ccaf5f2870993115230c519fba510015f53 Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Mon, 21 Mar 2016 22:39:15 +0000 Subject: [PATCH 02/13] Formatting and removal of unneccessary line --- defaults/main.yml | 3 +-- tasks/elasticsearch-plugins.yml | 9 +-------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index c2e4a94..7bf9af0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -16,5 +16,4 @@ es_pid_dir: "/var/run/elasticsearch" es_data_dirs: "/var/lib/elasticsearch" es_log_dir: "/var/log/elasticsearch" es_work_dir: "/tmp/elasticsearch" -es_plugin_dir: "/usr/share/elasticsearch/plugins" -es_proxy_port: 8080 \ No newline at end of file +es_plugin_dir: "/usr/share/elasticsearch/plugins" \ No newline at end of file diff --git a/tasks/elasticsearch-plugins.yml b/tasks/elasticsearch-plugins.yml index 1240882..8347c23 100644 --- a/tasks/elasticsearch-plugins.yml +++ b/tasks/elasticsearch-plugins.yml @@ -30,14 +30,7 @@ - name: Install elasticsearch plugins #debug: var=item command: > - {{es_home}}/bin/plugin install - {{ item.plugin }}{% if item.version is defined and item.version != '' %}/{{ item.version }}{% endif %} - {% if item.proxy_host is defined and item.proxy_host != '' and item.proxy_port is defined and item.proxy_port != ''%} - -DproxyHost={{ item.proxy_host }} -DproxyPort={{ item.proxy_port }} - {% elif es_proxy_host is defined and es_proxy_host != '' %} - -DproxyHost={{ es_proxy_host }} -DproxyPort={{ es_proxy_port }} - {% endif %} - --silent + {{es_home}}/bin/plugin install {{ item.plugin }}{% if item.version is defined and item.version != '' %}/{{ item.version }}{% endif %} {% if item.proxy_host is defined and item.proxy_host != '' and item.proxy_port is defined and item.proxy_port != ''%} -DproxyHost={{ item.proxy_host }} -DproxyPort={{ item.proxy_port }} {% elif es_proxy_host is defined and es_proxy_host != '' %} -DproxyHost={{ es_proxy_host }} -DproxyPort={{ es_proxy_port }} {% endif %} --silent register: plugin_installed failed_when: "'ERROR' in plugin_installed.stdout" changed_when: plugin_installed.rc == 0 From 2b852df5afe889b006a22bb6e66d14af21f7665a Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Mon, 21 Mar 2016 22:41:10 +0000 Subject: [PATCH 03/13] Default of ES 2.2.0 --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 7bf9af0..5f7bd60 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,6 @@ --- es_major_version: "2.x" -es_version: "2.1.0" +es_version: "2.2.0" es_version_lock: false es_use_repository: true es_start_service: true From 44d1d3200c2a9d2b9358b27d86987c2fa66c8e7e Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Mon, 21 Mar 2016 23:26:36 +0000 Subject: [PATCH 04/13] Test changes to test for 2.2 --- test/integration/config-2x/serverspec/default_spec.rb | 2 +- test/integration/multi-2x/serverspec/default_spec.rb | 2 +- test/integration/package-2x/serverspec/default_spec.rb | 2 +- test/integration/standard-2x/serverspec/default_spec.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/integration/config-2x/serverspec/default_spec.rb b/test/integration/config-2x/serverspec/default_spec.rb index 0650ee1..377fb3b 100644 --- a/test/integration/config-2x/serverspec/default_spec.rb +++ b/test/integration/config-2x/serverspec/default_spec.rb @@ -1,6 +1,6 @@ require 'config_spec' describe 'Config Tests v 2.x' do - include_examples 'config::init', "2.1.0" + include_examples 'config::init', "2.2.0" end diff --git a/test/integration/multi-2x/serverspec/default_spec.rb b/test/integration/multi-2x/serverspec/default_spec.rb index 4e1bc69..17bb9c1 100644 --- a/test/integration/multi-2x/serverspec/default_spec.rb +++ b/test/integration/multi-2x/serverspec/default_spec.rb @@ -2,7 +2,7 @@ require 'multi_spec' describe 'Multi Tests v 2.x' do - include_examples 'multi::init', "2.1.0", ["kopf","license","marvel-agent"] + include_examples 'multi::init', "2.2.0", ["kopf","license","marvel-agent"] end diff --git a/test/integration/package-2x/serverspec/default_spec.rb b/test/integration/package-2x/serverspec/default_spec.rb index f87daf7..bc884cc 100644 --- a/test/integration/package-2x/serverspec/default_spec.rb +++ b/test/integration/package-2x/serverspec/default_spec.rb @@ -2,5 +2,5 @@ require 'package_spec' describe 'Package Tests v 2.x' do - include_examples 'package::init', "2.1.0", ["kopf","license","marvel-agent"] + include_examples 'package::init', "2.2.0", ["kopf","license","marvel-agent"] end \ No newline at end of file diff --git a/test/integration/standard-2x/serverspec/default_spec.rb b/test/integration/standard-2x/serverspec/default_spec.rb index 3d61cb0..8f45e24 100644 --- a/test/integration/standard-2x/serverspec/default_spec.rb +++ b/test/integration/standard-2x/serverspec/default_spec.rb @@ -2,7 +2,7 @@ require 'standard_spec' describe 'Standard Tests v 2.x' do - include_examples 'standard::init', "2.1.0" + include_examples 'standard::init', "2.2.0" end From 987a46dce5ddf1fb5bd2a5e8e6c9b8d76022cc46 Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Tue, 22 Mar 2016 19:25:32 +0000 Subject: [PATCH 05/13] Kitchen Docker 2.3.0 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 8607482..545f3c3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' gem 'test-kitchen' -gem "kitchen-docker", '< 2.2.0' +gem "kitchen-docker", '2.3.0' gem 'kitchen-ansible', '0.40.1' gem 'net-ssh', '~> 2.0' From ac9b430b40bd322884bea247924f846789598639 Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Fri, 1 Apr 2016 13:14:03 +0100 Subject: [PATCH 06/13] Gem reversion --- Gemfile | 2 +- defaults/defaults.iml | 9 +++++++++ files/files.iml | 12 ++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 defaults/defaults.iml create mode 100644 files/files.iml diff --git a/Gemfile b/Gemfile index 545f3c3..12e348e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' gem 'test-kitchen' -gem "kitchen-docker", '2.3.0' +gem "kitchen-docker", '2.2.0' gem 'kitchen-ansible', '0.40.1' gem 'net-ssh', '~> 2.0' diff --git a/defaults/defaults.iml b/defaults/defaults.iml new file mode 100644 index 0000000..8021953 --- /dev/null +++ b/defaults/defaults.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/files/files.iml b/files/files.iml new file mode 100644 index 0000000..e9988ed --- /dev/null +++ b/files/files.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file From 040b76a73623a59565404106c03e89fb552a8f3e Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Fri, 1 Apr 2016 13:14:32 +0100 Subject: [PATCH 07/13] Remove .iml files --- defaults/defaults.iml | 9 --------- files/files.iml | 12 ------------ 2 files changed, 21 deletions(-) delete mode 100644 defaults/defaults.iml delete mode 100644 files/files.iml diff --git a/defaults/defaults.iml b/defaults/defaults.iml deleted file mode 100644 index 8021953..0000000 --- a/defaults/defaults.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/files/files.iml b/files/files.iml deleted file mode 100644 index e9988ed..0000000 --- a/files/files.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file From 4ef29c8a8ab6d122ea0112d71caf45113927ae94 Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Fri, 1 Apr 2016 13:19:32 +0100 Subject: [PATCH 08/13] Gem reversion to 2.1 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 12e348e..6b62086 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' gem 'test-kitchen' -gem "kitchen-docker", '2.2.0' +gem "kitchen-docker", '2.1.0' gem 'kitchen-ansible', '0.40.1' gem 'net-ssh', '~> 2.0' From dc0c83bdcb4d92513853b7065b70a32d6d9ae138 Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Fri, 1 Apr 2016 15:22:50 +0100 Subject: [PATCH 09/13] wget and curl for debian 8 image --- .kitchen.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 0348eaf..c32bf0f 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -32,10 +32,10 @@ platforms: use_sudo: false - name: debian-8 driver_config: - image: electrical/debian:8 + image: debian:8 privileged: true provision_command: - - apt-get update && apt-get -y install python python-dev python-pip build-essential libyaml-dev python-yaml + - apt-get update && apt-get -y install python python-dev python-pip build-essential libyaml-dev python-yaml openssh-server curl wget - pip install ansible - apt-get install -y -q net-tools - sed -ri 's/^#?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config From a50e8beca000af62b3c4a0a53be667598c3043fc Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Fri, 1 Apr 2016 17:44:49 +0100 Subject: [PATCH 10/13] New Centos 7 image --- .kitchen.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index c32bf0f..fede6e5 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -35,7 +35,7 @@ platforms: image: debian:8 privileged: true provision_command: - - apt-get update && apt-get -y install python python-dev python-pip build-essential libyaml-dev python-yaml openssh-server curl wget + - apt-get update && apt-get -y install python python-dev python-pip build-essential libyaml-dev python-yaml curl wget - pip install ansible - apt-get install -y -q net-tools - sed -ri 's/^#?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config @@ -53,7 +53,7 @@ platforms: use_sudo: false - name: centos-7 driver_config: - image: electrical/centos:7 + image: dliappis/centos:7 provision_command: - yum -y install gmp-devel python-devel python-pip - yum -y groupinstall "Development Tools" From 686c9fd1496a77354355c1a39c48533f0166da73 Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Fri, 1 Apr 2016 22:09:25 +0100 Subject: [PATCH 11/13] Docker images moved to dliappis --- .kitchen.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index fede6e5..b31529d 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -15,7 +15,7 @@ provisioner: platforms: - name: ubuntu-14.04 driver_config: - image: electrical/ubuntu:14.04 + image: dliappis/ubuntu:14.04 privileged: true provision_command: - apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:ansible/ansible @@ -23,7 +23,7 @@ platforms: use_sudo: false - name: debian-7 driver_config: - image: electrical/debian:7.3 + image: debian:7 privileged: true provision_command: - apt-get update && apt-get -y install python python-dev python-pip build-essential libyaml-dev python-yaml @@ -45,7 +45,7 @@ platforms: run_command: "/sbin/init" - name: centos-6 driver_config: - image: electrical/centos:6.4-1 + image: dliappis/centos:6 privileged: true provision_command: - yum -y install gmp-devel python-devel python-pip From 83fb9ae5e827fc288d9459d47bb7446cf909b763 Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Sat, 2 Apr 2016 21:42:35 +0100 Subject: [PATCH 12/13] Image changes --- .kitchen.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.kitchen.yml b/.kitchen.yml index b31529d..f0d6ad1 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -48,6 +48,7 @@ platforms: image: dliappis/centos:6 privileged: true provision_command: + - yum remove -y ansible - yum -y install gmp-devel python-devel python-pip - pip install ansible use_sudo: false @@ -55,6 +56,7 @@ platforms: driver_config: image: dliappis/centos:7 provision_command: + - yum remove -y ansible - yum -y install gmp-devel python-devel python-pip - yum -y groupinstall "Development Tools" - pip install ansible From 482231aadcc9619273084a51701bb42f9a1b5202 Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Sat, 2 Apr 2016 21:54:27 +0100 Subject: [PATCH 13/13] Kitchen test version 1.4.2 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6b62086..e0591b1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'test-kitchen' +gem 'test-kitchen', '1.4.2' gem "kitchen-docker", '2.1.0' gem 'kitchen-ansible', '0.40.1' gem 'net-ssh', '~> 2.0'