diff --git a/ansible/roles/common/templates/heka.json.j2 b/ansible/roles/common/templates/heka.json.j2
index 2cb4bcbe54..5b2de756a4 100644
--- a/ansible/roles/common/templates/heka.json.j2
+++ b/ansible/roles/common/templates/heka.json.j2
@@ -45,7 +45,8 @@
             "source": "{{ container_config_directory }}/heka-mariadb.toml",
             "dest": "/etc/heka/heka-mariadb.toml",
             "owner": "heka",
-            "perm": "0600"
+            "perm": "0600",
+            "optional": {{ (not enable_mariadb | bool) | string | lower }}
         },
         {
             "source": "{{ container_config_directory }}/heka-keystone.toml",