initial commit
diff --git a/defaults/main.yml b/defaults/main.yml
index 3195b56..af08886 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -1,2 +1,3 @@
 ---
-# defaults file for apigee-opdk-debug-mode
\ No newline at end of file
+# defaults file for apigee-opdk-debug-mode
+bash_regex: '#$.*bash$'
diff --git a/tasks/main.yml b/tasks/main.yml
index 1077c38..65017df 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -4,28 +4,38 @@
   - name: Collect all bash scripts
     find:
       paths: '{{ apigee_installation_home }}'
-      contains: '^\#\$.*bash$'
+      contains: '^{{ bash_regex }}$'
     register: debug_scripts
 
+  - name: Examine debug_scripts
+    debug:
+      var: debug_scripts
+
   - name: Add debug flag
     lineinfile:
+      path: "{{ item.path }}"
       backrefs: yes
       backup: yes
-      regexp: '(^\#\$.*bash$)'
+      regexp: '^({{ bash_regex }})'
       line: '\1 -x'
-  when: opdk_debug_mode is defined and opdk_debug_mode == 'on'
+    with_items: "{{ debug_scripts }}"
+
+  when: opdk_debug_mode is defined and opdk_debug_mode | trim | lowercase== 'on'
 
 - block:
   - name: Collect all bash scripts
     find:
       paths: '{{ apigee_installation_home }}'
-      contains: '^\#\$.*bash -x$'
+      contains: '^{{ bash_regex }} -x$'
     register: debug_scripts
 
   - name: Add debug flag
     lineinfile:
+      path: "{{ item.path }}"
       backrefs: yes
       backup: yes
-      regexp: '(^\#\$.*bash$) (-x)'
+      regexp: '^({{ bash_regex }}$) (-x)'
       line: '\1'
-  when: opdk_debug_mode is defined and opdk_debug_mode == 'off'
+    with_items: "{{ debug_scripts }}"
+
+  when: opdk_debug_mode is defined and opdk_debug_mode | trim | lowercase == 'off'