From b29d74f4de6fed5e90fd5a159db1d1cb9ba854f2 Mon Sep 17 00:00:00 2001 From: Will Foster Date: Fri, 3 Jun 2016 12:26:01 +0100 Subject: [PATCH] Replace dummy 1.1.1.1 values for graphite_host, grafana_host This adds a sanity check that will fail if the user has not filled out the grafana_host and graphite_host values in group_vars/all.yml It will cause the grafana playbook execution to fail with a debug warning which is cleaner than having it execute all the way through only to fail later. We would ship these entries defined but empty as a result. Patchset #2: correct typo in commit title Patchset #3: move to top of playbook so if it fails it will be right away. Patchset #4: README.MD update: specify that these values need to be filled in Change-Id: I333798398ee0a84d1af51b9344b7c4798aad2043 --- ansible/README.md | 1 + ansible/install/group_vars/all.yml | 6 ++++-- ansible/install/roles/grafana/tasks/main.yml | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ansible/README.md b/ansible/README.md index e1b8415c2..25f0f9e38 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -93,6 +93,7 @@ the docker related settings will work with your target host. ##### Install grafana service Prior to installing grafana, please review install/group_vars/all.yml file and your ansible inventory file +You will need to define values for the grafana_host and graphite_host IP addresses here. ``` # ansible-playbook -i hosts install/grafana.yml ``` diff --git a/ansible/install/group_vars/all.yml b/ansible/install/group_vars/all.yml index 25515d60b..258cddaa4 100644 --- a/ansible/install/group_vars/all.yml +++ b/ansible/install/group_vars/all.yml @@ -67,7 +67,8 @@ grafana_docker_image: grafana/grafana:2.6.0 # Graphite Configuration ######################################## # Graphite Server ip address (Collectd -> Graphite server) -graphite_host: 1.1.1.1 +# you must fill out graphite_host prior to playbook execution +graphite_host: graphite_port: 80 # Graphite prefix / Cloud name used both with graphite and grafana dashboards graphite_prefix: openstack @@ -79,7 +80,8 @@ graphite_password: calvin # Grafana Dashboarding Configuration ######################################## # Grafana Server IP Address/Port (Can be hosted on the Graphite server) -grafana_host: 1.1.1.1 +# you must fill out grafana_host prior to playbook execution +grafana_host: grafana_port: 3000 grafana_username: admin grafana_password: admin diff --git a/ansible/install/roles/grafana/tasks/main.yml b/ansible/install/roles/grafana/tasks/main.yml index c5da54813..cf67ba45e 100644 --- a/ansible/install/roles/grafana/tasks/main.yml +++ b/ansible/install/roles/grafana/tasks/main.yml @@ -3,6 +3,12 @@ # Install/run grafana-server for browbeat # +# check that grafana_host and graphite_host is entered prior to playbook run +- name: Check Graphite/Grafana Host IP Address + fail: + msg="** Edit grafana_host and graphite_host in ../install/group_vars/all.yml before running **" + when: ((grafana_host is none) and (graphite_host is none)) + - name: Import EPEL GPG Key rpm_key: key=https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 state=present