refactoring of elastic roles

- extract java8
- extract elastic-source-list
This commit is contained in:
Jérémy Lecour 2016-11-17 16:46:38 +01:00 committed by Jérémy Lecour
parent 6a7f8ebe6d
commit 11083007d6
14 changed files with 74 additions and 71 deletions

View File

@ -0,0 +1,9 @@
# elastic-source-list
Install Elastic sources list for APT.
## Tasks
Everything is in the `tasks/main.yml` file.
## Available variables

View File

@ -23,16 +23,3 @@
tags:
- system
- packages
- name: Elasticsearch is installed
apt:
name: elasticsearch
update_cache: yes
state: installed
tags:
- packages
- name: Elasticsearch service is enabled
service:
name: elasticsearch
enabled: yes

View File

@ -6,8 +6,7 @@ Install Elasticsearch.
Tasks are extracted in several files, included in `tasks/main.yml` :
* `java.yml` : install Java 8 ;
* `elasticsearch.yml` : install packages ;
* `packages.yml` : install packages ;
* `configuration.yml` : configure the service;
* `bootstrap_checks.yml` : deal with bootstrap checks;
* `datadir.yml` : data directory customization ;

View File

@ -1,7 +1,7 @@
---
- block:
- name: "Is {{ elasticsearch_custom_datadir }} present ?"
- name: "Is custom datadir present ?"
stat:
path: "{{ elasticsearch_custom_datadir }}"
register: elasticsearch_custom_datadir_test
@ -20,7 +20,7 @@
name: elasticsearch
state: stopped
- name: Move elasticsearch datadir to {{ elasticsearch_custom_datadir }}
- name: Move elasticsearch datadir to custom datadir
command: mv {{ elasticsearch_current_real_datadir_test.stdout }} {{ elasticsearch_custom_datadir }}
args:
creates: "{{ elasticsearch_custom_datadir }}"

View File

@ -1,8 +1,6 @@
---
- include: java.yml
- include: elasticsearch.yml
- include: packages.yml
- include: configuration.yml

View File

@ -0,0 +1,14 @@
---
- name: Elasticsearch is installed
apt:
name: elasticsearch
update_cache: yes
state: installed
tags:
- packages
- name: Elasticsearch service is enabled
service:
name: elasticsearch
enabled: yes

View File

@ -1,29 +1,5 @@
---
- name: APT https transport is enabled
apt:
name: apt-transport-https
state: installed
tags:
- system
- packages
- name: Elastic GPG key is installed
apt_key:
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
state: present
tags:
- system
- packages
- name: Elastic sources list is available
apt_repository:
repo: "deb https://artifacts.elastic.co/packages/5.x/apt stable main"
state: present
tags:
- system
- packages
- name: Filebeat is installed
apt:
name: filebeat

11
java8/README.md Normal file
View File

@ -0,0 +1,11 @@
# java8
Install OpenJDK 1.8 (from jessie-backports)
## Tasks
Everything is in the `tasks/main.yml` file.
## Available variables
* `java8_default_alternative`: make this verison the default alternative (defaults to true)

1
java8/defaults/main.yml Normal file
View File

@ -0,0 +1 @@
java8_default_alternative: True

View File

@ -13,3 +13,6 @@
alternatives:
name: java
path: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
when: java8_default_alternative
tags:
- java

View File

@ -1,29 +1,5 @@
---
- name: APT https transport is enabled
apt:
name: apt-transport-https
state: installed
tags:
- system
- packages
- name: Elastic GPG key is installed
apt_key:
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
state: present
tags:
- system
- packages
- name: Elastic sources list is available
apt_repository:
repo: "deb https://artifacts.elastic.co/packages/5.x/apt stable main"
state: present
tags:
- system
- packages
- name: Kibana is installed
apt:
name: kibana

10
logstash/README.md Normal file
View File

@ -0,0 +1,10 @@
# logstash
Install Logstash.
## Tasks
Everything is in the `tasks/main.yml` file.
The pipeline must be configured before starting Logstash.
https://www.elastic.co/guide/en/logstash/5.0/index.html

14
logstash/tasks/main.yml Normal file
View File

@ -0,0 +1,14 @@
---
- name: Logstash is installed
apt:
name: logstash
update_cache: yes
state: installed
tags:
- packages
- name: Logstash service is enabled
service:
name: logstash
enabled: yes

View File

@ -5,8 +5,8 @@
roles:
# - { role: apt-upgrade, apt_upgrade_mode: safe }
# - apt-upgrade
# - apt-backports
- apt-upgrade
- apt-backports
# - munin
# - monit
# - redis
@ -21,7 +21,12 @@
# nginx_private_htpasswd_absent: ["toto:dsfgdfsdf"]
# }
# - apache
- java8
# - { role: elasticsearch, elasticsearch_custom_tmpdir: "/var/lib/elasticsearch/tmp" }
# - elasticsearch
- elastic-source-list
- elasticsearch
# - elasticsearch-plugin-head
- elasticsearch-plugin-head
- kibana
- logstash
- filebeat