diff --git a/group_vars/all.yml b/group_vars/all.yml
index b3be5f2..9ce1795 100644
--- a/group_vars/all.yml
+++ b/group_vars/all.yml
@@ -25,3 +25,16 @@ atl_installer_temp: "{{ atl_installation_base }}/tmp"
# set in /etc/atl by the CloudFormation template and sourced before
# Ansible is run. See bin/ansible-with-atl-env for a convenient wrapper
atl_efs_id: "{{ lookup('env', 'ATL_EFS_ID') }}"
+
+atl_jdbc_url: "{{ lookup('env', 'ATL_JDBC_URL') }}"
+atl_jdbc_user: "{{ lookup('env', 'ATL_JDBC_USER') }}"
+atl_jdbc_password: "{{ lookup('env', 'ATL_JDBC_PASSWORD') }}"
+
+atl_jdbc_driver: "{{ lookup('env', 'ATL_JDBC_DRIVER') or 'org.postgresql.Driver' }}"
+atl_db_poolminsize: "{{ lookup('env', 'ATL_DB_POOLMINSIZE') or '20' }}"
+atl_db_poolmaxsize: "{{ lookup('env', 'ATL_DB_POOLMAXSIZE') or '100' }}"
+atl_db_minidle: "{{ lookup('env', 'ATL_DB_MINIDLE') or '10' }}"
+atl_db_maxidle: "{{ lookup('env', 'ATL_DB_MAXIDLE') or '20' }}"
+
+atl_jvm_heap: "{{ lookup('env', 'ATL_JVM_HEAP) }}"
+atl_catalina_opts: "{{ lookup('env', 'ATL_CATALINA_OPTS) }}"
diff --git a/roles/jira_config/.yamllint b/roles/jira_config/.yamllint
new file mode 100644
index 0000000..ad0be76
--- /dev/null
+++ b/roles/jira_config/.yamllint
@@ -0,0 +1,11 @@
+extends: default
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ line-length: disable
+ truthy: disable
diff --git a/roles/jira_config/molecule/default/Dockerfile.j2 b/roles/jira_config/molecule/default/Dockerfile.j2
new file mode 100644
index 0000000..e6aa95d
--- /dev/null
+++ b/roles/jira_config/molecule/default/Dockerfile.j2
@@ -0,0 +1,14 @@
+# Molecule managed
+
+{% if item.registry is defined %}
+FROM {{ item.registry.url }}/{{ item.image }}
+{% else %}
+FROM {{ item.image }}
+{% endif %}
+
+RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
+ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
+ elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
+ elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
+ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
+ elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
diff --git a/roles/jira_config/molecule/default/molecule.yml b/roles/jira_config/molecule/default/molecule.yml
new file mode 100644
index 0000000..3941903
--- /dev/null
+++ b/roles/jira_config/molecule/default/molecule.yml
@@ -0,0 +1,24 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: amazon_linux2
+ image: amazonlinux:2
+ - name: ubuntu_lts
+ image: ubuntu:bionic
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+ inventory:
+ links:
+ group_vars: ../../../../group_vars/
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
+ enabled: false
diff --git a/roles/jira_config/molecule/default/playbook.yml b/roles/jira_config/molecule/default/playbook.yml
new file mode 100644
index 0000000..0b419ea
--- /dev/null
+++ b/roles/jira_config/molecule/default/playbook.yml
@@ -0,0 +1,14 @@
+---
+- name: Converge
+ hosts: all
+ vars:
+ atl_product_family: "jira"
+ atl_product_edition: "jira-software"
+ atl_product_user: "jira"
+ atl_product_version: "7.13.2"
+ atl_jdbc_user: 'atljira'
+ roles:
+ - role: linux_common
+ - role: product_common
+ - role: jira_download
+ - role: jira_config
diff --git a/roles/jira_config/molecule/default/tests/test_default.py b/roles/jira_config/molecule/default/tests/test_default.py
new file mode 100644
index 0000000..92ecfb1
--- /dev/null
+++ b/roles/jira_config/molecule/default/tests/test_default.py
@@ -0,0 +1,15 @@
+import os
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
+
+
+def test_hosts_file(host):
+ f = host.file('/var/atlassian/application-data/jira/dbconfig.xml')
+ assert f.exists
+ assert f.user == 'jira'
+ assert f.contains("org.postgresql.Driver")
+ assert f.contains("atljira")
+ assert f.contains("20")
diff --git a/roles/jira_config/tasks/main.yml b/roles/jira_config/tasks/main.yml
new file mode 100644
index 0000000..9a17ccd
--- /dev/null
+++ b/roles/jira_config/tasks/main.yml
@@ -0,0 +1,7 @@
+---
+
+- name: Create dbconfig.xml
+ template:
+ src: dbconfig.xml.j2
+ dest: "{{ atl_product_home }}/dbconfig.xml"
+ owner: "{{ atl_product_user }}"
diff --git a/roles/jira_config/templates/dbconfig.xml.j2 b/roles/jira_config/templates/dbconfig.xml.j2
new file mode 100644
index 0000000..1a91405
--- /dev/null
+++ b/roles/jira_config/templates/dbconfig.xml.j2
@@ -0,0 +1,28 @@
+
+
+
+ defaultDS
+ default
+ postgres72
+ public
+
+ {{ atl_jdbc_url }}
+ {{ atl_jdbc_driver }}
+ {{ atl_jdbc_user }}
+ {{ atl_jdbc_password }}
+
+ {{ atl_db_poolminsize }}
+ {{ atl_db_poolmaxsize }}
+ {{ atl_db_minidle }}
+ {{ atl_db_maxidle }}
+
+ 30000
+ select 1
+ 30000
+ 5000
+ true
+ 300
+ true
+ false
+
+