Skip to content

Commit 73fe7de

Browse files
author
Sohan Yadav
committed
initial commit
0 parents  commit 73fe7de

19 files changed

+603
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ignored files
2+
.idea
3+
*.iml
4+
*.zip
5+
molecule

.pre-commit-config.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
repos:
3+
4+
- repo: https://github.com/pre-commit/pre-commit-hooks.git
5+
rev: v2.2.3
6+
hooks:
7+
- id: end-of-file-fixer
8+
- id: trailing-whitespace
9+
- id: mixed-line-ending
10+
- id: check-byte-order-marker
11+
- id: check-executables-have-shebangs
12+
- id: check-merge-conflict
13+
- id: debug-statements
14+
- id: check-yaml
15+
- id: check-added-large-files

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Cloud Drove
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export GENIE_PATH ?= $(shell 'pwd')/../../../genie
2+
3+
include $(GENIE_PATH)/Makefile

README.md

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<!-- This file was automatically generated by the `geine`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->
2+
3+
4+
<p align="center"> <img src="https://user-images.githubusercontent.com/50652676/62451340-ba925480-b78b-11e9-99f0-13a8a9cc0afa.png" width="100" height="100"></p>
5+
6+
<h1 align="center">
7+
Ansible Role Docker Elasticsearch
8+
</h1>
9+
10+
<p align="center" style="font-size: 1.2rem;">
11+
This ansible role is used to install Elasticsearch Server with docker on linux.
12+
</p>
13+
14+
<p align="center">
15+
16+
<a href="https://www.ansible.com">
17+
<img src="https://img.shields.io/badge/Ansible-2.8-green?style=flat&logo=ansible" alt="Ansible">
18+
</a>
19+
<a href="LICENSE.md">
20+
<img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="Licence">
21+
</a>
22+
<a href="https://ubuntu.com/">
23+
<img src="https://img.shields.io/badge/ubuntu-16.x-orange?style=flat&logo=ubuntu" alt="Distribution">
24+
</a>
25+
<a href="https://ubuntu.com/">
26+
<img src="https://img.shields.io/badge/ubuntu-18.x-orange?style=flat&logo=ubuntu" alt="Distribution">
27+
</a>
28+
<a href="https://www.centos.org/">
29+
<img src="https://img.shields.io/badge/centos-7.x-orange" alt="Distribution">
30+
</a>
31+
32+
33+
</p>
34+
<p align="center">
35+
36+
<a href='https://facebook.com/sharer/sharer.php?u=https://github.com/clouddrove/ansible-role-docker-elasticsearch'>
37+
<img title="Share on Facebook" src="https://user-images.githubusercontent.com/50652676/62817743-4f64cb80-bb59-11e9-90c7-b057252ded50.png" />
38+
</a>
39+
<a href='https://www.linkedin.com/shareArticle?mini=true&title=Ansible+Role+Docker+Elasticsearch&url=https://github.com/clouddrove/ansible-role-docker-elasticsearch'>
40+
<img title="Share on LinkedIn" src="https://user-images.githubusercontent.com/50652676/62817742-4e339e80-bb59-11e9-87b9-a1f68cae1049.png" />
41+
</a>
42+
<a href='https://twitter.com/intent/tweet/?text=Ansible+Role+Docker+Elasticsearch&url=https://github.com/clouddrove/ansible-role-docker-elasticsearch'>
43+
<img title="Share on Twitter" src="https://user-images.githubusercontent.com/50652676/62817740-4c69db00-bb59-11e9-8a79-3580fbbf6d5c.png" />
44+
</a>
45+
46+
</p>
47+
<hr>
48+
49+
50+
51+
We eat, drink, sleep and most importantly love **DevOps**. DevOps always promotes automation and standardisation. While setting up various environments like local, dev, testing, production, etc. it is critical to maintain the same environment across. This can easily be achieved using automating the environment setup & installation with the help of ansible-playbooks.
52+
53+
Smaller roles are created for each environment elements; which also include tasks & tests. These roles can then be grouped together in [ansible-playbook](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html) to achieve the desired yet consistent results.
54+
55+
56+
57+
## Prerequisites
58+
59+
This module has a few dependencies:
60+
61+
- [Ansible2.8](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html)
62+
- [Python](https://www.python.org/downloads)
63+
- [Docker](https://docs.docker.com/install/linux/docker-ce/ubuntu)
64+
65+
66+
67+
68+
## What Includes
69+
70+
Followiing things includes in this role:
71+
- Elasticsearch
72+
73+
74+
75+
76+
77+
78+
79+
## Example Playbook
80+
81+
**IMPORTANT:** Since the `master` branch used in `source` varies based on new modifications, we suggest that you use the release versions [here](https://github.com/clouddrove/ansible-role-docker-elasticsearch/releases).
82+
83+
84+
```yaml
85+
- hosts: localhost
86+
remote_user: root
87+
roles:
88+
- clouddrove.ansible_role_docker_elasticsearch
89+
```
90+
## Example hosts.ini
91+
```ini
92+
[elasticsearch]
93+
elasticsearch = ansible_host=34.228.21.221 Env=dev EcType=elasticsearch EcName=dev-elasticsearch Az=a Nr=0 PrivateIp=10.0.109.170
94+
```
95+
96+
## Variables
97+
98+
```yaml
99+
es_version: "6.7.2"
100+
es_xmx: "{{ ( ansible_memtotal_mb * 0.20 ) | round(0, 'ceil') | int }}"
101+
es_user: elastic
102+
es_group: elastic
103+
mount_path: /data
104+
es_opt_dir: "/opt/elasticsearch"
105+
es_config_dir: "{{ es_opt_dir }}/config"
106+
es_tmp_dir: "{{ mount_path }}/tmp/elasticsearch"
107+
es_data_dir: "{{ mount_path }}/elasticsearch"
108+
es_log_dir: "/var/log/elasticsearch"
109+
es_port: 9200
110+
es_publish_port: 9300
111+
es_host: "0.0.0.0"
112+
es_publish_host: "{{ es_host }}"
113+
es_bind_host: "{{ es_host }}"
114+
es_node_name: "{{ hostvars[inventory_hostname].EcName | safe | trim }}"
115+
```
116+
117+
118+
## Installation
119+
120+
```console
121+
$ ansible-galaxy install clouddrove.ansible_role_docker_elasticsearch
122+
```
123+
124+
125+
126+
127+
128+
129+
## Feedback
130+
If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/ansible-role-docker-elasticsearch/issues), or feel free to drop us an email at [[email protected]](mailto:[email protected]).
131+
132+
If you have found it worth your time, go ahead and give us a ★ on [our GitHub](https://github.com/clouddrove/ansible-role-docker-elasticsearch)!
133+
134+
## About us
135+
136+
At [CloudDrove][website], we offer expert guidance, implementation support and services to help organisations accelerate their journey to the cloud. Our services include docker and container orchestration, cloud migration and adoption, infrastructure automation, application modernisation and remediation, and performance engineering.
137+
138+
<p align="center">We are <b> The Cloud Experts!</b></p>
139+
<hr />
140+
<p align="center">We ❤️ <a href="https://github.com/clouddrove">Open Source</a> and you can check out <a href="https://github.com/clouddrove">our other modules</a> to get help with your new Cloud ideas.</p>
141+
142+
[website]: https://clouddrove.com
143+
[github]: https://github.com/clouddrove
144+
[linkedin]: https://cpco.io/linkedin
145+
[twitter]: https://twitter.com/clouddrove/
146+
[email]: https://clouddrove.com/contact-us.html
147+
[terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language=

README.yaml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
#
3+
# This is the canonical configuration for the `README.md`
4+
# Run `make readme` to rebuild the `README.md`
5+
#
6+
7+
# Name of this project
8+
name: Ansible Role Docker Elasticsearch
9+
10+
# License of this project
11+
license: "MIT"
12+
13+
# Canonical GitHub repo
14+
github_repo: clouddrove/ansible-role-docker-elasticsearch
15+
16+
# Badges to display
17+
badges:
18+
- name: "Ansible"
19+
image: "https://img.shields.io/badge/Ansible-2.8-green?style=flat&logo=ansible"
20+
url: "https://www.ansible.com"
21+
- name: "Licence"
22+
image: "https://img.shields.io/badge/License-MIT-blue.svg"
23+
url: "LICENSE.md"
24+
- name: "Distribution"
25+
image: "https://img.shields.io/badge/ubuntu-16.x-orange?style=flat&logo=ubuntu"
26+
url: "https://ubuntu.com/"
27+
- name: "Distribution"
28+
image: "https://img.shields.io/badge/ubuntu-18.x-orange?style=flat&logo=ubuntu"
29+
url: "https://ubuntu.com/"
30+
- name: "Distribution"
31+
image: "https://img.shields.io/badge/centos-7.x-orange"
32+
url: "https://www.centos.org/"
33+
# Prerequesties to display
34+
# yamllint disable
35+
prerequesties:
36+
- name: "Ansible2.8"
37+
url: "https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html"
38+
- name: "Python"
39+
url: "https://www.python.org/downloads"
40+
- name: "Docker"
41+
url: "https://docs.docker.com/install/linux/docker-ce/ubuntu"
42+
# yamllint enable
43+
# What Includes to display
44+
what_includes:
45+
- name: "Elasticsearch"
46+
47+
# description of this project
48+
description: |-
49+
This ansible role is used to install Elasticsearch Server with docker on linux.
50+
51+
# How to use this project
52+
usage: |-
53+
```yaml
54+
- hosts: localhost
55+
remote_user: root
56+
roles:
57+
- clouddrove.ansible_role_docker_elasticsearch
58+
```
59+
# Variables use in the project
60+
variables: |-
61+
```yaml
62+
es_version: "6.7.2"
63+
es_xmx: "{{ ( ansible_memtotal_mb * 0.20 ) | round(0, 'ceil') | int }}"
64+
es_user: elastic
65+
es_group: elastic
66+
mount_path: /data
67+
es_opt_dir: "/opt/elasticsearch"
68+
es_config_dir: "{{ es_opt_dir }}/config"
69+
es_tmp_dir: "{{ mount_path }}/tmp/elasticsearch"
70+
es_data_dir: "{{ mount_path }}/elasticsearch"
71+
es_log_dir: "/var/log/elasticsearch"
72+
es_port: 9200
73+
es_publish_port: 9300
74+
es_host: "0.0.0.0"
75+
es_publish_host: "{{ es_host }}"
76+
es_bind_host: "{{ es_host }}"
77+
es_node_name: "{{ hostvars[inventory_hostname].EcName | safe | trim }}"
78+
```
79+
# How to install project
80+
installation: |-
81+
```console
82+
$ ansible-galaxy install clouddrove.ansible_role_docker_elasticsearch
83+
```

defaults/main.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
# version
3+
es_version: "6.7.2"
4+
5+
# memory settings
6+
es_xmx: "{{ ( ansible_memtotal_mb * 0.30 ) | round(0, 'ceil') | int }}"
7+
8+
# user settings
9+
es_user: elastic
10+
es_group: elastic
11+
# data mounting
12+
mount_path: /data
13+
14+
# elasticearch settings
15+
es_opt_dir: "/opt/elasticsearch"
16+
es_config_dir: "{{ es_opt_dir }}/config"
17+
es_tmp_dir: "{{ mount_path }}/tmp/elasticsearch"
18+
es_data_dir: "{{ mount_path }}/elasticsearch"
19+
es_log_dir: "/var/log/elasticsearch"
20+
21+
# elasticsearch network settings
22+
es_port: 9200
23+
es_publish_port: 9300
24+
es_host: "0.0.0.0"
25+
es_publish_host: "{{ es_host }}"
26+
es_bind_host: "{{ es_host }}"
27+
28+
# elasticsearch node settings
29+
es_node_name: "{{ hostvars[inventory_hostname].EcName | safe | trim }}"

handlers/main.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
- name: restart elasticsearch
3+
service:
4+
name: elasticsearch
5+
state: restarted
6+
enabled: true
7+
8+
- name: reload elasticsearch
9+
systemd:
10+
name: elasticsearch
11+
state: reloaded
12+
13+
- name: start elasticsearch
14+
systemd:
15+
name: elasticsearch
16+
state: started

meta/main.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
dependencies: []
3+
4+
galaxy_info:
5+
author: clouddrove
6+
description: This ansible role is used to install Elasticsearch Server with docker on linux.
7+
company: "CloudDrove, LLC"
8+
license: "license (BSD, MIT)"
9+
min_ansible_version: 2.4
10+
platforms:
11+
- name: Debian
12+
versions:
13+
- jessie
14+
- stretch
15+
- name: Ubuntu
16+
versions:
17+
- trusty
18+
- xenial
19+
- bionic
20+
- name: EL
21+
versions:
22+
- 7
23+
galaxy_tags:
24+
- system
25+
- server
26+
- elasticsearch
27+
- ubuntu
28+
- debian
29+
- centos
30+
- search
31+
- docker

tasks/configure.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
- name: create elasticsearch dirs
3+
file:
4+
path: "{{ item|safe|trim }}"
5+
state: directory
6+
owner: "{{ es_user }}"
7+
group: "{{ es_group }}"
8+
mode: 0777
9+
recurse: true
10+
changed_when: false
11+
with_items:
12+
- "{{ es_opt_dir }}"
13+
- "{{ es_config_dir }}"
14+
- "{{ es_tmp_dir }}"
15+
- "{{ es_data_dir }}"
16+
17+
- name: create elasticsearch configuration file
18+
template:
19+
dest: "{{ es_config_dir }}/{{ item | basename }}"
20+
owner: "{{ es_user }}"
21+
group: "{{ es_group }}"
22+
mode: 0644
23+
force: true
24+
src: "{{ item }}"
25+
with_items:
26+
- elasticsearch.yml
27+
- log4j2.properties
28+
- analysis/stopword.txt
29+
- analysis/synonym.txt
30+
31+
- name: set vm.max_map_count to 262144 in sysctl
32+
sysctl:
33+
name: "{{ item.key }}"
34+
value: "{{ item.value }}"
35+
with_items:
36+
- { key: "vm.max_map_count", value: "262144" }

0 commit comments

Comments
 (0)