Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to support both RPM and YUM based distros. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Example
- hosts: myhost2
roles:
- role: common/elasticsearch
elasticsearch_version: 1.4
elasticsearch_config:
# Accept only localhost connections
network.bind_host: "127.0.0.1"
Expand All @@ -36,6 +37,15 @@ List of variables used by the role:

```
# Default elasticsearch configuration
elasticsearch_version: 2.x
# available versions are:
# 0.90
# 1.3
# 1.4
# 1.5
# 1.6
# 1.7
# 2.x
elasticsearch_config: {}
```

Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

# Default YUM repo URL
elasticsearch_yum_repo_url: http://packages.elasticsearch.org/elasticsearch/1.4/centos
elasticsearch_yum_repo_url: http://packages.elasticsearch.org/elasticsearch/{{ elasticsearch_version }}/centos

# Package to be installed (you can force a specific version here)
elasticsearch_pkg: elasticsearch
Expand Down
5 changes: 3 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ galaxy_info:
- system
dependencies:
- role: common/yumrepo
when: ansible_pkg_mgr == "yum"
yumrepo_repos:
elasticsearch-1.4:
name: Elasticsearch repository for 1.4.x packages
elasticsearch:
name: Elasticsearch repository for {{ elasticsearch_version }}.x packages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove .x.

baseurl: "{{ elasticsearch_yum_repo_url }}"
gpgcheck: 0
- common/elasticsearch
Expand Down
4 changes: 4 additions & 0 deletions tasks/add-apt-repo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Import Elasticsearch key
apt_key: url=https://packages.elastic.co/GPG-KEY-elasticsearch state=present
- name: Add Elasticsearch Repo
apt_repository: repo="deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" state=present
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.x should be replaced by {{ elasticsearch_version }}.

13 changes: 5 additions & 8 deletions tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
---
- name: Add apt-repo for Debian/Ubuntu
include: add-apt-repo.yaml
when: ansible_pkg_mgr == "apt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not create additional task files. Please insert the single task in here.


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please retain this distro check. Please just add check for Debian.

- name: Test distribution
assert:
that: ansible_os_family == "RedHat"

- name: Install elasticsearch package for RedHat
yum:
name: "{{ elasticsearch_pkg }}"
state: present
- name: Install elasticsearch package
action: "{{ ansible_pkg_mgr }} name={{ elasticsearch_pkg }} state=present"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use in-line YAML. Also use of yum and apt modules is preferred over the action.

notify:
- Restart elasticsearch
tags:
Expand Down
10 changes: 10 additions & 0 deletions vars/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
---
# Default Elasticsearch settings
# available versions are:
# 0.90
# 1.3
# 1.4
# 1.5
# 1.6
# 1.7
# 2.x
elasticsearch_version: 2.x

# Default Java settings
oracle_java_version_minor: 7
Expand Down