From 6b22b17e515c6a2168d312b2c1fb6a698a742bbe Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Mon, 27 Jul 2015 20:07:49 +0200
Subject: [PATCH] Tests and bug fixes

---
 defaults/main.yml                             |  2 +-
 tasks/main.yml                                | 49 ++++++++++---------
 .../etc-apache2-sites-available-sd-agent      |  1 +
 3 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/defaults/main.yml b/defaults/main.yml
index 284184e..1c9fe5f 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -17,5 +17,5 @@ sd_groups:
 
 sd_repo_public_key_uri: 'https://www.serverdensity.com/downloads/boxedice-public.key'
 sd_agent_plugins_dir: '/usr/bin/sd-agent/plugins'
-sd_plugins_files_dir: "{{ inventory_dir }}/files/sd-plugins"
+sd_plugins_files_dir: "{{ playbook_dir }}/files/sd-plugins"
 sd_template_config: 'config.cfg'
diff --git a/tasks/main.yml b/tasks/main.yml
index 77987d4..1076825 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -1,55 +1,56 @@
 ---
 # file: roles/serverdensity/tasks/main.yml
 
-- name: 'ServerDensity | Init SD plugin'
+- name: "ServerDensity | Init SD plugin"
   local_action:
     serverdensity
-    api_token={{sd_api_token}}
-    cleanup={{sd_alert_cleanup}}
+    api_token={{ sd_api_token }}
+    cleanup={{ sd_alert_cleanup }}
     force={{ sd_force_update }}
-    cache={{sd_api_cache_file}}
+    cache={{ sd_api_cache_file }}
   when: sd_update_remote
 
-- name: 'ServerDensity | Install Public Repo Key'
+- name: "ServerDensity | Install Public Repo Key"
   apt_key:
-    url="{{ sd_repo_public_key_uri }}"
+    url={{ sd_repo_public_key_uri }}
     state=present
 
-- name: 'ServerDensity | Add ServerDensity Repository To Apt'
+- name: "ServerDensity | Add ServerDensity Repository To Apt"
   copy:
     content='deb http://www.serverdensity.com/downloads/linux/deb all main'
-    dest='/etc/apt/sources.list.d/sd-agent.list'
+    dest=/etc/apt/sources.list.d/sd-agent.list
     mode=644
 
-- name: 'ServerDensity | Install The Agent'
+- name: "ServerDensity | Install The Agent"
   apt:
     pkg=sd-agent
     state=installed
     update_cache=yes
-  notify: 'ServerDensity | Restart Agent'
+  notify: "ServerDensity | Restart Agent"
 
-- name: 'ServerDensity | Create Plugins Directory'
+- name: "ServerDensity | Create Plugins Directory"
   file:
-    dest="{{ sd_agent_plugins_dir }}"
+    dest={{ sd_agent_plugins_dir }}
     state=directory
     mode=755
 
-- name: 'ServerDensity | Copy Plugins'
+- name: "ServerDensity | Copy Plugins"
   copy:
-    src="{{ sd_plugins_files_dir }}/{{item.1}}"
-    dest="{{ sd_agent_plugins_dir }}/{{item.1}}"
+    src={{ sd_plugins_files_dir }}/{{ item.1 }}
+    dest={{ sd_agent_plugins_dir }}/{{ item.1 }}
   with_items: sd_plugins|dictsort
   when: sd_plugins|length > 0
-  notify: 'ServerDensity | Restart Agent'
-
-- name: 'ServerDensity | Configure The Agent'
-  template: src="{{ sd_template_config }}"
-            dest=/etc/sd-agent/config.cfg
-            owner=root
-            group=root
-            mode=0644
+  notify: "ServerDensity | Restart Agent"
+
+- name: "ServerDensity | Configure The Agent"
+  template:
+    src={{ sd_template_config }}
+    dest=/etc/sd-agent/config.cfg
+    owner=root
+    group=root
+    mode=0644
   when: sd_agent_key != ''
-  notify: 'ServerDensity | Restart Agent'
+  notify: "ServerDensity | Restart Agent"
 
 - include: apache.yml
   when: sd_groups.apache != 'none' and inventory_hostname in groups[sd_groups.apache]
diff --git a/templates/etc-apache2-sites-available-sd-agent b/templates/etc-apache2-sites-available-sd-agent
index 95ad829..2a90228 100644
--- a/templates/etc-apache2-sites-available-sd-agent
+++ b/templates/etc-apache2-sites-available-sd-agent
@@ -4,6 +4,7 @@
         Order Deny,Allow
         Deny from all
         Allow from 127.0.0.1{% for address in ansible_all_ipv4_addresses %} {{ address }}{% endfor %}
+
     </Location>
     ServerName {{ inventory_hostname }}
 </VirtualHost>
-- 
GitLab