Merge pull request #87 from gingerwizard/master

Correct Error detection for plugin install and check logging.yml is removed
This commit is contained in:
gingerwizard 2016-04-02 23:09:52 +01:00
commit 83303e494b
13 changed files with 33 additions and 24 deletions

View file

@ -15,7 +15,7 @@ provisioner:
platforms: platforms:
- name: ubuntu-14.04 - name: ubuntu-14.04
driver_config: driver_config:
image: electrical/ubuntu:14.04 image: dliappis/ubuntu:14.04
privileged: true privileged: true
provision_command: provision_command:
- apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:ansible/ansible - 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 use_sudo: false
- name: debian-7 - name: debian-7
driver_config: driver_config:
image: electrical/debian:7.3 image: debian:7
privileged: true privileged: true
provision_command: 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
@ -32,10 +32,10 @@ platforms:
use_sudo: false use_sudo: false
- name: debian-8 - name: debian-8
driver_config: driver_config:
image: electrical/debian:8 image: debian:8
privileged: true privileged: true
provision_command: 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 curl wget
- pip install ansible - pip install ansible
- apt-get install -y -q net-tools - apt-get install -y -q net-tools
- sed -ri 's/^#?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config - sed -ri 's/^#?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config
@ -45,16 +45,18 @@ platforms:
run_command: "/sbin/init" run_command: "/sbin/init"
- name: centos-6 - name: centos-6
driver_config: driver_config:
image: electrical/centos:6.4-1 image: dliappis/centos:6
privileged: true privileged: true
provision_command: provision_command:
- yum remove -y ansible
- yum -y install gmp-devel python-devel python-pip - yum -y install gmp-devel python-devel python-pip
- pip install ansible - pip install ansible
use_sudo: false use_sudo: false
- name: centos-7 - name: centos-7
driver_config: driver_config:
image: electrical/centos:7 image: dliappis/centos:7
provision_command: provision_command:
- yum remove -y ansible
- yum -y install gmp-devel python-devel python-pip - yum -y install gmp-devel python-devel python-pip
- yum -y groupinstall "Development Tools" - yum -y groupinstall "Development Tools"
- pip install ansible - pip install ansible

View file

@ -1,6 +1,6 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'test-kitchen' gem 'test-kitchen', '1.4.2'
gem "kitchen-docker", '< 2.2.0' gem "kitchen-docker", '2.1.0'
gem 'kitchen-ansible', '0.40.1' gem 'kitchen-ansible', '0.40.1'
gem 'net-ssh', '~> 2.0' gem 'net-ssh', '~> 2.0'

View file

@ -8,7 +8,7 @@ Ansible role for Elasticsearch. Currently this works on Debian and RedHat based
* Centos 6 * Centos 6
* Centos 7 * 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 ## Usage

View file

@ -1,6 +1,6 @@
--- ---
es_major_version: "2.x" es_major_version: "2.x"
es_version: "2.1.0" es_version: "2.2.0"
es_version_lock: false es_version_lock: false
es_use_repository: true es_use_repository: true
es_start_service: true es_start_service: true

View file

@ -5,7 +5,6 @@
when: elasticsearch_install.changed or es_plugins is not defined or es_plugins is none 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"
- set_fact: list_command="--list" - set_fact: list_command="--list"
when: es_version | version_compare('2.0', '<') when: es_version | version_compare('2.0', '<')
@ -31,16 +30,9 @@
- name: Install elasticsearch plugins - name: Install elasticsearch plugins
#debug: var=item #debug: var=item
command: > command: >
{{es_home}}/bin/plugin install {{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
{{ 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 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 changed_when: plugin_installed.rc == 0
with_items: es_plugins with_items: es_plugins
when: es_plugins is defined and not es_plugins is none when: es_plugins is defined and not es_plugins is none

View file

@ -1,6 +1,6 @@
require 'config_spec' require 'config_spec'
describe 'Config Tests v 2.x' do describe 'Config Tests v 2.x' do
include_examples 'config::init', "2.1.0" include_examples 'config::init', "2.2.0"
end end

View file

@ -103,6 +103,10 @@ shared_examples 'config::init' do |es_version|
it { should_not exist } it { should_not exist }
end end
describe file('/etc/elasticsearch/logging.yml') do
it { should_not exist }
end
#Init vs Systemd tests #Init vs Systemd tests
#Ubuntu 15 and up #Ubuntu 15 and up
#Debian 8 and up #Debian 8 and up

View file

@ -225,6 +225,9 @@ shared_examples 'multi::init' do |es_version,plugins|
it { should_not exist } it { should_not exist }
end 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 #Test server spec file has been created and modified - currently not possible as not copied for debian 8

View file

@ -103,5 +103,9 @@ shared_examples 'package::init' do |es_version,plugins|
it { should_not exist } it { should_not exist }
end end
describe file('/etc/elasticsearch/logging.yml') do
it { should_not exist }
end
end end

View file

@ -67,5 +67,9 @@ shared_examples 'standard::init' do |es_version|
it { should_not exist } it { should_not exist }
end end
describe file('/etc/elasticsearch/logging.yml') do
it { should_not exist }
end
end end

View file

@ -2,7 +2,7 @@ require 'multi_spec'
describe 'Multi Tests v 2.x' do 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 end

View file

@ -2,5 +2,5 @@ require 'package_spec'
describe 'Package Tests v 2.x' do 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 end

View file

@ -2,7 +2,7 @@ require 'standard_spec'
describe 'Standard Tests v 2.x' do describe 'Standard Tests v 2.x' do
include_examples 'standard::init', "2.1.0" include_examples 'standard::init', "2.2.0"
end end