Moved Kibana to a role

Untested but should be moved over.
This commit is contained in:
James Tombleson 2019-04-26 16:01:55 -07:00
parent 74c75c3d36
commit b27e8dda28
5 changed files with 81 additions and 6 deletions

View File

@ -19,5 +19,4 @@
- name: systemd - restart Kibana - name: systemd - restart Kibana
become: true become: true
systemd: systemd:
name: kibana name: kiband
state: restarted

View File

@ -13,3 +13,13 @@
systemd_enabled: true systemd_enabled: true
systemd_restart: true systemd_restart: true
- name: install kibana
import_role:
name: kibana
vars:
server_port: 5601
server_host: ansible_default_ipv4.address
server_name: ansible_hostname
elasticsearch_hosts:
- http://192.168.0.173:9200

View File

@ -8,8 +8,32 @@
# Role variables # Role variables
# #
# Allow 5601 though UFW
ufw_server_port: false
# systemd - enable Kibana on startup
systemd_enabled: false
# systemd - restart Kibana
systemd_restart: false
# #
# Configuration file variables # Configuration file variables
# #
# Defines that port that Kibana will listen on
# Default: 5601
server_port: 5601
# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address.
server_host: localhost
# The Kibana server's name. This is used for display purposes.
server_name: {{ ansible_hostname }}
# The URLs of the Elasticsearch instances to use for all your queries.
elasticsearch_hosts:
- localhost
- server02

View File

@ -0,0 +1,42 @@
# This handles the install and configuration for ubuntu based computers.
- name: Install Elastic Repo
include: install-repo.yml
- name: Intall Kibana from APT
become: true
apt:
name: kibana
- name: Update Kibana config from template
become: true
template:
src: kibana.j2
dest: /etc/kibana/kibana.yml
backup: true
- name: Allow 5601 though UFW
when: ufw_server_port == true_
become: true
ufw:
rule: allow
port: server_port
- name: systemd - daemon reload
become: true
systemd:
daemon_reload: yes
- name: systemd - enable Kibana on startup
when: systemd_enabled == true
become: true
systemd:
name: kibana
enabled: yes
- name: systemd - restart Kibana
when: systemd_restart == true
become: true
systemd:
name: kiband

View File

@ -1,14 +1,14 @@
# Kibana is served by a back end server. This setting specifies the port to use. # Kibana is served by a back end server. This setting specifies the port to use.
#server.port: 5601 #server.port: 5601
server.port: {{ k_server_port }} server.port: {{ server_port }}
# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values. # Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect. # The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address. # To allow connections from remote users, set this parameter to a non-loopback address.
#server.host: "192.168.0.173" #server.host: "192.168.0.173"
server.host: {{ ansible_default_ipv4.address }} server.host: {{ server_host }}
# Enables you to specify a path to mount Kibana at if you are running behind a proxy. # Enables you to specify a path to mount Kibana at if you are running behind a proxy.
# Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath # Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath
@ -26,12 +26,12 @@ server.host: {{ ansible_default_ipv4.address }}
#server.maxPayloadBytes: 1048576 #server.maxPayloadBytes: 1048576
# The Kibana server's name. This is used for display purposes. # The Kibana server's name. This is used for display purposes.
server.name: {{ ansible_hostname }} server.name: {{ server_name }}
# The URLs of the Elasticsearch instances to use for all your queries. # The URLs of the Elasticsearch instances to use for all your queries.
#elasticsearch.hosts: ["http://localhost:9200"] #elasticsearch.hosts: ["http://localhost:9200"]
elasticsearch.hosts: [ elasticsearch.hosts: [
{{ k_elasticsearch_hosts }} {{ elasticsearch_hosts }}
] ]
# When this setting's value is true Kibana uses the hostname specified in the server.host # When this setting's value is true Kibana uses the hostname specified in the server.host