From 5938b03d4eb8cf5707c8c71feba441d1aebef9db Mon Sep 17 00:00:00 2001
From: Miouge1 <maxime@root314.com>
Date: Mon, 30 Jul 2018 17:02:51 +0200
Subject: [PATCH] Add Prometheus node_exporter

This change introduces node_exporter into the monitoring stack. The
role from cloudalchemi is used for the bulk of the deployment.

Change-Id: I1343db378f9dee056a5fb67e0dc9e89e11bc7e28
---
 prometheus/README.rst                    | 36 ++++++++++++++++++++++++
 prometheus/ansible-role-requirements.yml |  5 ++++
 prometheus/installNodeExporter.yml       | 20 +++++++++++++
 prometheus/vars/variables.yml            |  1 +
 4 files changed, 62 insertions(+)
 create mode 100644 prometheus/README.rst
 create mode 100644 prometheus/ansible-role-requirements.yml
 create mode 100644 prometheus/installNodeExporter.yml
 create mode 100644 prometheus/vars/variables.yml

diff --git a/prometheus/README.rst b/prometheus/README.rst
new file mode 100644
index 00000000..f2c34c1b
--- /dev/null
+++ b/prometheus/README.rst
@@ -0,0 +1,36 @@
+Install Prometheus
+##################
+:tags: openstack, ansible
+
+About this repository
+---------------------
+
+This set of playbooks will deploy Prometheus. If this is being deployed as part of
+an OpenStack all of the inventory needs will be provided for.
+
+**These playbooks require Ansible 2.4+.**
+
+Deployment Process
+------------------
+
+Clone the repo
+
+.. code-block:: bash
+
+    cd /opt
+    git clone https://github.com/openstack/openstack-ansible-ops
+
+Downloading role dependencies
+
+.. code-block:: bash
+
+    cd /opt/openstack-ansible-ops/prometheus
+    ansible-galaxy install -r ansible-role-requirements.yml
+
+
+Install node_exporter
+
+.. code-block:: bash
+
+    cd /opt/openstack-ansible-ops/prometheus
+    openstack-ansible installNodeExporter.yml
diff --git a/prometheus/ansible-role-requirements.yml b/prometheus/ansible-role-requirements.yml
new file mode 100644
index 00000000..68f9b8c4
--- /dev/null
+++ b/prometheus/ansible-role-requirements.yml
@@ -0,0 +1,5 @@
+---
+- name: node-exporter
+  scm: git
+  src: https://github.com/cloudalchemy/ansible-node-exporter
+  version: master
diff --git a/prometheus/installNodeExporter.yml b/prometheus/installNodeExporter.yml
new file mode 100644
index 00000000..e840f5ca
--- /dev/null
+++ b/prometheus/installNodeExporter.yml
@@ -0,0 +1,20 @@
+---
+# 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.
+
+- name: node_exporter
+  hosts: hosts
+  vars_files:
+    - vars/variables.yml
+  roles:
+    - role: node-exporter
diff --git a/prometheus/vars/variables.yml b/prometheus/vars/variables.yml
new file mode 100644
index 00000000..42f6a661
--- /dev/null
+++ b/prometheus/vars/variables.yml
@@ -0,0 +1 @@
+node_exporter_web_listen_address: "{{ ansible_host }}:9100"