mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-10 06:51:04 +01:00
Added elk draft
This commit is contained in:
parent
0ff9953127
commit
3448734482
5
roles/docker-elk/handlers/main.yml
Normal file
5
roles/docker-elk/handlers/main.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: recreate docker-elk
|
||||||
|
command:
|
||||||
|
cmd: docker-compose -p docker-elk up -d --force-recreate
|
||||||
|
chdir: /srv/docker-elk
|
80
roles/docker-elk/tasks/main.yml
Normal file
80
roles/docker-elk/tasks/main.yml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: recieve {{domain}} certificate
|
||||||
|
command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}}
|
||||||
|
|
||||||
|
- name: configure {{domain}}.conf
|
||||||
|
template: src=roles/native-nginx-docker-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf
|
||||||
|
notify: restart nginx
|
||||||
|
|
||||||
|
- name: "create /etc/docker-elk"
|
||||||
|
file:
|
||||||
|
path: "/etc/docker-elk"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: copy elasticsearch.yml
|
||||||
|
template: src=elasticsearch.yml dest=/etc/docker-elk/elasticsearch.yml
|
||||||
|
|
||||||
|
- name: copy kibana.yml
|
||||||
|
template: src=kibana.yml dest=/etc/docker-elk/kibana.yml
|
||||||
|
|
||||||
|
- name: copy logstash.yml
|
||||||
|
template: src=logstash.yml dest=/etc/docker-elk/logstash.yml
|
||||||
|
|
||||||
|
- name: copy logstash.conf
|
||||||
|
template: src=logstash.conf dest=/etc/docker-elk/logstash.conf
|
||||||
|
|
||||||
|
- name: "setup elk"
|
||||||
|
docker_compose:
|
||||||
|
project_name: elk
|
||||||
|
definition:
|
||||||
|
elasticsearch:
|
||||||
|
image: elasticsearch
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- type: bind
|
||||||
|
source: /etc/docker-elk/elasticsearch.yml
|
||||||
|
target: /usr/share/elasticsearch/config/elasticsearch.yml
|
||||||
|
read_only: true
|
||||||
|
- type: volume
|
||||||
|
source: elasticsearch
|
||||||
|
target: /usr/share/elasticsearch/data
|
||||||
|
ports:
|
||||||
|
- "9200:9200"
|
||||||
|
- "9300:9300"
|
||||||
|
environment:
|
||||||
|
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
|
||||||
|
ELASTIC_PASSWORD: changeme
|
||||||
|
# Use single node discovery in order to disable production mode and avoid bootstrap checks.
|
||||||
|
# see: https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
|
||||||
|
discovery.type: single-node
|
||||||
|
logstash:
|
||||||
|
image: logstash
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- type: bind
|
||||||
|
source: /etc/docker-elk/logstash.yml
|
||||||
|
target: /usr/share/logstash/config/logstash.yml
|
||||||
|
read_only: true
|
||||||
|
- type: bind
|
||||||
|
source: /etc/docker-elk/logstash.conf
|
||||||
|
target: /usr/share/logstash/pipeline/logstash.conf
|
||||||
|
read_only: true
|
||||||
|
ports:
|
||||||
|
- "5044:5044"
|
||||||
|
- "5000:5000/tcp"
|
||||||
|
- "5000:5000/udp"
|
||||||
|
- "9600:9600"
|
||||||
|
environment:
|
||||||
|
LS_JAVA_OPTS: "-Xmx256m -Xms256m"
|
||||||
|
kibana:
|
||||||
|
image: kibana
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- type: bind
|
||||||
|
source: /etc/docker-elk/kibana.yml
|
||||||
|
target: /usr/share/kibana/config/kibana.yml
|
||||||
|
read_only: true
|
||||||
|
ports:
|
||||||
|
- "5601:5601"
|
13
roles/docker-elk/templates/elasticsearch.yml
Normal file
13
roles/docker-elk/templates/elasticsearch.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
## Default Elasticsearch configuration from Elasticsearch base image.
|
||||||
|
## https://github.com/elastic/elasticsearch/blob/master/distribution/docker/src/docker/config/elasticsearch.yml
|
||||||
|
#
|
||||||
|
cluster.name: "docker-cluster"
|
||||||
|
network.host: 0.0.0.0
|
||||||
|
|
||||||
|
## X-Pack settings
|
||||||
|
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack.html
|
||||||
|
#
|
||||||
|
xpack.license.self_generated.type: basic
|
||||||
|
xpack.security.enabled: true
|
||||||
|
xpack.monitoring.collection.enabled: true
|
13
roles/docker-elk/templates/kibana.yml
Normal file
13
roles/docker-elk/templates/kibana.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
## Default Kibana configuration from Kibana base image.
|
||||||
|
## https://github.com/elastic/kibana/blob/master/src/dev/build/tasks/os_packages/docker_generator/templates/kibana_yml.template.ts
|
||||||
|
#
|
||||||
|
server.name: kibana
|
||||||
|
server.host: 0.0.0.0
|
||||||
|
elasticsearch.hosts: [ "http://elasticsearch:9200" ]
|
||||||
|
monitoring.ui.container.elasticsearch.enabled: true
|
||||||
|
|
||||||
|
## X-Pack security credentials
|
||||||
|
#
|
||||||
|
elasticsearch.username: elastic
|
||||||
|
elasticsearch.password: changeme
|
20
roles/docker-elk/templates/logstash.conf
Normal file
20
roles/docker-elk/templates/logstash.conf
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
input {
|
||||||
|
beats {
|
||||||
|
port => 5044
|
||||||
|
}
|
||||||
|
|
||||||
|
tcp {
|
||||||
|
port => 5000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
## Add your filters / logstash plugins configuration here
|
||||||
|
|
||||||
|
output {
|
||||||
|
elasticsearch {
|
||||||
|
hosts => "elasticsearch:9200"
|
||||||
|
user => "elastic"
|
||||||
|
password => "changeme"
|
||||||
|
ecs_compatibility => disabled
|
||||||
|
}
|
||||||
|
}
|
12
roles/docker-elk/templates/logstash.yml
Normal file
12
roles/docker-elk/templates/logstash.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
## Default Logstash configuration from Logstash base image.
|
||||||
|
## https://github.com/elastic/logstash/blob/master/docker/data/logstash/config/logstash-full.yml
|
||||||
|
#
|
||||||
|
http.host: "0.0.0.0"
|
||||||
|
xpack.monitoring.elasticsearch.hosts: [ "http://elasticsearch:9200" ]
|
||||||
|
|
||||||
|
## X-Pack security credentials
|
||||||
|
#
|
||||||
|
xpack.monitoring.enabled: true
|
||||||
|
xpack.monitoring.elasticsearch.username: elastic
|
||||||
|
xpack.monitoring.elasticsearch.password: changeme
|
Loading…
Reference in New Issue
Block a user