diff --git a/roles/emit-ara-html/README.rst b/roles/emit-ara-html/README.rst
index bca365610..83a389e66 100644
--- a/roles/emit-ara-html/README.rst
+++ b/roles/emit-ara-html/README.rst
@@ -12,6 +12,11 @@ Have ARA generate html logs if ARA and ARA data are both present.
Whether to compress the ARA HTML output or not.
Defaults to ``true``.
+.. zuul:rolevar:: ara_save_database
+
+ Whether the ARA sqlite database should be saved as part of the logs.
+ Defaults to ``false``.
+
.. tip::
Make sure the web server is configured to set the required mimetypes_ in
order to serve gzipped content properly.
diff --git a/roles/emit-ara-html/defaults/main.yaml b/roles/emit-ara-html/defaults/main.yaml
index c95c8acdc..7fd6f4fe7 100644
--- a/roles/emit-ara-html/defaults/main.yaml
+++ b/roles/emit-ara-html/defaults/main.yaml
@@ -3,3 +3,6 @@ ara_generate_html: true
# Whether to compress the ARA HTML output or not
ara_compress_html: true
+
+# Whether to save the ARA sqlite database as part of the logs or not
+ara_save_database: false
diff --git a/roles/emit-ara-html/tasks/main.yaml b/roles/emit-ara-html/tasks/main.yaml
index 34a71ad98..6a31393f8 100644
--- a/roles/emit-ara-html/tasks/main.yaml
+++ b/roles/emit-ara-html/tasks/main.yaml
@@ -3,6 +3,14 @@
path: "{{ zuul.executor.work_root }}/.ara/ansible.sqlite"
register: ara_db_stat
+- name: Save the ARA database
+ command: |
+ cp "{{ zuul.executor.work_root }}/.ara/ansible.sqlite" \
+ {{ zuul.executor.log_root }}
+ when:
+ - ara_db_stat.stat.exists
+ - ara_save_database | bool
+
- name: Check for ARA install
command: which ara
ignore_errors: yes
@@ -20,4 +28,4 @@
- name: Compress ARA html output
command: gzip --recursive --best {{ zuul.executor.log_root }}/ara
ignore_errors: yes
- when: ara_compress_html | bool
+ when: ara_compress_html | bool
\ No newline at end of file