Initial commit
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
new file mode 100644
index 0000000..29c1b00
--- /dev/null
+++ b/CHANGELOG.rst
@@ -0,0 +1,6 @@
+kibana-formula
+==============
+
+0.0.1 (2015-08-03)
+
+- Initial formula setup
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..6f2b42f
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,13 @@
+Copyright (c) 2014-2015 tcp cloud a.s.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..98b9c76
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,44 @@
+
+======
+Kibana
+======
+
+Kibana is an open source (Apache Licensed), browser based analytics and search interface to Logstash and other timestamped data sets stored in ElasticSearch. With those in place Kibana is a snap to setup and start using (seriously). Kibana strives to be easy to get started with, while also being flexible and powerful
+
+Sample pillar
+=============
+
+.. code-block:: yaml
+
+ kibana:
+ server:
+ addrepo: true
+ enabled: true
+ bind:
+ address: 0.0.0.0
+ port: 5601
+ database:
+ engine: elasticsearch
+ host: localhost
+ port: 9200
+
+Or without adding elasticsearch kibana repository
+
+.. code-block:: yaml
+
+ kibana:
+ server:
+ enabled: true
+ bind:
+ address: 0.0.0.0
+ port: 5601
+ database:
+ engine: elasticsearch
+ host: localhost
+ port: 9200
+
+
+Read more
+=========
+
+* https://github.com/elasticsearch/kibana/blob/master/src/config.js
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..3b04cfb
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.2
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..596c56d
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,11 @@
+salt-formula-kibana (0.2) trusty; urgency=medium
+
+ * First public release
+
+ -- Filip Pytloun <filip.pytloun@tcpcloud.eu> Tue, 06 Oct 2015 16:38:45 +0200
+
+salt-formula-kibana (0.1) trusty; urgency=medium
+
+ * Initial release
+
+ -- Jakub Pavlik <jakub.pavlik@tcpcloud.eu> Thu, 13 Aug 2015 23:23:41 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..8ef7ea7
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,15 @@
+Source: salt-formula-kibana
+Maintainer: Jakub Pavlik <jakub.pavlik@tcpcloud.eu>
+Section: admin
+Priority: optional
+Build-Depends: debhelper (>= 9)
+Standards-Version: 3.9.6
+Homepage: http://www.tcpcloud.eu
+Vcs-Browser: https://github.com/tcpcloud/salt-formula-kibana
+Vcs-Git: https://github.com/tcpcloud/salt-formula-kibana.git
+
+Package: salt-formula-kibana
+Architecture: all
+Depends: ${misc:Depends}, salt-master, reclass
+Description: Kibana Salt formula
+ Install and configure Kibana server and client.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..13d8ed7
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,15 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: salt-formula-kibana
+Upstream-Contact: Jakub Pavlik <jakub.pavlik@tcpcloud.eu>
+Source: https://github.com/tcpcloud/salt-formula-kibana
+
+Files: *
+Copyright: 2014-2015 tcp cloud
+License: Apache-2.0
+ Copyright (C) 2014-2015 tcp cloud
+ .
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ .
+ On a Debian system you can find a copy of this license in
+ /usr/share/common-licenses/Apache-2.0.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..d585829
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,3 @@
+README.rst
+CHANGELOG.rst
+VERSION
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..669ac6f
--- /dev/null
+++ b/debian/install
@@ -0,0 +1,2 @@
+kibana/* /usr/share/salt-formulas/env/kibana/
+metadata/service/* /usr/share/salt-formulas/reclass/service/kibana/
diff --git a/debian/rules b/debian/rules
new file mode 100644
index 0000000..abde6ef
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,5 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@
+
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/kibana/files/kibana.yml b/kibana/files/kibana.yml
new file mode 100644
index 0000000..951ff75
--- /dev/null
+++ b/kibana/files/kibana.yml
@@ -0,0 +1,79 @@
+{%- from "kibana/map.jinja" import server with context %}
+
+# Kibana is served by a back end server. This controls which port to use.
+port: {{ server.bind.port }}
+
+# The host to bind the server to.
+host: "{{ server.bind.address }}"
+
+# The Elasticsearch instance to use for all your queries.
+elasticsearch_url: "http://{{ server.database.host }}:{{ server.database.port }}"
+
+# preserve_elasticsearch_host true will send the hostname specified in `elasticsearch`. If you set it to false,
+# then the host you use to connect to *this* Kibana instance will be sent.
+elasticsearch_preserve_host: true
+
+# Kibana uses an index in Elasticsearch to store saved searches, visualizations
+# and dashboards. It will create a new index if it doesn't already exist.
+kibana_index: ".kibana"
+
+# If your Elasticsearch is protected with basic auth, this is the user credentials
+# used by the Kibana server to perform maintence on the kibana_index at statup. Your Kibana
+# users will still need to authenticate with Elasticsearch (which is proxied thorugh
+# the Kibana server)
+# kibana_elasticsearch_username: user
+# kibana_elasticsearch_password: pass
+
+# If your Elasticsearch requires client certificate and key
+# kibana_elasticsearch_client_crt: /path/to/your/client.crt
+# kibana_elasticsearch_client_key: /path/to/your/client.key
+
+# If you need to provide a CA certificate for your Elasticsarech instance, put
+# the path of the pem file here.
+# ca: /path/to/your/CA.pem
+
+# The default application to load.
+default_app_id: "discover"
+
+# Time in milliseconds to wait for elasticsearch to respond to pings, defaults to
+# request_timeout setting
+# ping_timeout: 1500
+
+# Time in milliseconds to wait for responses from the back end or elasticsearch.
+# This must be > 0
+request_timeout: 300000
+
+# Time in milliseconds for Elasticsearch to wait for responses from shards.
+# Set to 0 to disable.
+shard_timeout: 0
+
+# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying
+# startup_timeout: 5000
+
+# Set to false to have a complete disregard for the validity of the SSL
+# certificate.
+verify_ssl: true
+
+# SSL for outgoing requests from the Kibana Server (PEM formatted)
+# ssl_key_file: /path/to/your/server.key
+# ssl_cert_file: /path/to/your/server.crt
+
+# Set the path to where you would like the process id file to be created.
+# pid_file: /var/run/kibana.pid
+
+# If you would like to send the log output to a file you can set the path below.
+# This will also turn off the STDOUT log output.
+# log_file: ./kibana.log
+
+# Plugins that are included in the build, and no longer found in the plugins/ folder
+bundled_plugin_ids:
+ - plugins/dashboard/index
+ - plugins/discover/index
+ - plugins/doc/index
+ - plugins/kibana/index
+ - plugins/markdown_vis/index
+ - plugins/metric_vis/index
+ - plugins/settings/index
+ - plugins/table_vis/index
+ - plugins/vis_types/index
+ - plugins/visualize/index
\ No newline at end of file
diff --git a/kibana/init.sls b/kibana/init.sls
new file mode 100644
index 0000000..2003aa5
--- /dev/null
+++ b/kibana/init.sls
@@ -0,0 +1,5 @@
+
+{%- if pillar.kibana.server is defined %}
+include:
+- kibana.server
+{%- endif %}
diff --git a/kibana/map.jinja b/kibana/map.jinja
new file mode 100644
index 0000000..a6736e3
--- /dev/null
+++ b/kibana/map.jinja
@@ -0,0 +1,7 @@
+
+{% set server = salt['grains.filter_by']({
+ 'Debian': {
+ 'pkgname': 'kibana',
+ 'service': 'kibana',
+ },
+}, merge=salt['pillar.get']('kibana:server')) %}
diff --git a/kibana/server.sls b/kibana/server.sls
new file mode 100644
index 0000000..8122fdc
--- /dev/null
+++ b/kibana/server.sls
@@ -0,0 +1,35 @@
+{%- from "kibana/map.jinja" import server with context %}
+{%- if server.enabled %}
+
+{%- if server.addrepo is defined and grains['os_family'] == 'Debian' %}
+
+kibana_repo:
+ pkgrepo.managed:
+ - humanname: Kibana Repository
+ - name: deb http://packages.elastic.co/kibana/4.1/debian stable main
+ - dist: stable
+ - file: /etc/apt/sources.list.d/kibana.list
+ - key_url: https://packages.elastic.co/GPG-KEY-elasticsearch
+
+{%- endif %}
+
+kibana_package:
+ pkg.installed:
+ - name: {{ server.pkgname }}
+
+kibana_service:
+ service.running:
+ - enable: true
+ - name: {{ server.service }}
+ - watch:
+ - file: /opt/kibana/config/kibana.yml
+
+/opt/kibana/config/kibana.yml:
+ file.managed:
+ - source: salt://kibana/files/kibana.yml
+ - template: jinja
+ - require:
+ - pkg: kibana_package
+
+{%- endif %}
+
diff --git a/metadata/service/server/single.yml b/metadata/service/server/single.yml
new file mode 100644
index 0000000..fd6d447
--- /dev/null
+++ b/metadata/service/server/single.yml
@@ -0,0 +1,16 @@
+applications:
+- kibana
+parameters:
+ kibana:
+ server:
+ enabled: true
+ version: latest
+ source:
+ engine: file
+ bind:
+ address: 0.0.0.0
+ port: 5601
+ database:
+ engine: elasticsearch
+ host: localhost
+ port: 9200