diff --git a/bin/ansible-with-atl-env b/bin/ansible-with-atl-env
index 3833140..c58cd46 100755
--- a/bin/ansible-with-atl-env
+++ b/bin/ansible-with-atl-env
@@ -18,4 +18,4 @@ if [[ -f .venv/bin/ansible ]]; then
source .venv/bin/activate
fi
-ansible-playbook -v -i $INV $PLAYBOOK | tee --append $LOG_FILE
+ansible-playbook -v -i $INV $PLAYBOOK 2>&1 | tee --append $LOG_FILE
diff --git a/group_vars/aws_node_local.yml b/group_vars/aws_node_local.yml
index 40f5f63..5d0f330 100644
--- a/group_vars/aws_node_local.yml
+++ b/group_vars/aws_node_local.yml
@@ -44,6 +44,7 @@ atl_aws_stack_name: "{{ lookup('env', 'ATL_AWS_STACK_NAME') }}"
atl_aws_region: "{{ lookup('env', 'ATL_AWS_REGION') }}"
atl_aws_iam_role: "{{ lookup('env', 'ATL_AWS_IAM_ROLE') }}"
+atl_db_engine: "{{ lookup('env', 'ATL_DB_ENGINE') }}"
atl_db_host: "{{ lookup('env', 'ATL_DB_HOST') }}"
atl_db_port: "{{ lookup('env', 'ATL_DB_PORT') or '5432' }}"
atl_db_root_user: "{{ lookup('env', 'ATL_DB_ROOT_USER') or 'postgres' }}"
@@ -70,7 +71,9 @@ atl_jdbc_encoding: "{{ lookup('env', 'ATL_JDBC_ENCODING') or 'UTF-8' }}"
atl_jdbc_collation: "{{ lookup('env', 'ATL_JDBC_COLLATION') or 'en_US.UTF-8' }}"
atl_jdbc_ctype: "{{ lookup('env', 'ATL_JDBC_CTYPE') or 'en_US.UTF-8' }}"
atl_jdbc_template: "{{ lookup('env', 'ATL_JDBC_TEMPLATE') or 'template1' }}"
-atl_jdbc_url: "jdbc:postgresql://{{ atl_db_host }}:{{ atl_db_port }}/{{ atl_jdbc_db_name }}"
+atl_jdbc_query_params_for_engine:
+ aurora_postgres: "?targetServerType=master"
+atl_jdbc_url: "jdbc:postgresql://{{ atl_db_host }}:{{ atl_db_port }}/{{ atl_jdbc_db_name }}{{ atl_jdbc_query_params_for_engine[atl_db_engine]| default('') }}"
atl_jvm_heap: "{{ lookup('env', 'ATL_JVM_HEAP') or '2048m' }}"
atl_catalina_opts: "{{ lookup('env', 'ATL_CATALINA_OPTS') or '' }}"
diff --git a/roles/confluence_config/molecule/aurora/Dockerfile.j2 b/roles/confluence_config/molecule/aurora/Dockerfile.j2
new file mode 100644
index 0000000..e6aa95d
--- /dev/null
+++ b/roles/confluence_config/molecule/aurora/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/confluence_config/molecule/aurora/molecule.yml b/roles/confluence_config/molecule/aurora/molecule.yml
new file mode 100644
index 0000000..33c377c
--- /dev/null
+++ b/roles/confluence_config/molecule/aurora/molecule.yml
@@ -0,0 +1,32 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: amazon_linux2
+ image: amazonlinux:2
+ groups:
+ - aws_node_local
+ - name: ubuntu_lts
+ image: ubuntu:bionic
+ groups:
+ - aws_node_local
+provisioner:
+ name: ansible
+ options:
+ skip-tags: runtime_pkg
+ lint:
+ name: ansible-lint
+ options:
+ x: ["701"]
+ inventory:
+ links:
+ group_vars: ../../../../group_vars/
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
+ enabled: false
diff --git a/roles/confluence_config/molecule/aurora/playbook.yml b/roles/confluence_config/molecule/aurora/playbook.yml
new file mode 100644
index 0000000..d57ff60
--- /dev/null
+++ b/roles/confluence_config/molecule/aurora/playbook.yml
@@ -0,0 +1,23 @@
+---
+- name: Converge
+ hosts: all
+ vars:
+ atl_product_family: "confluence"
+ atl_product_edition: "confluence"
+ atl_product_user: "confluence"
+ atl_product_version: "latest"
+ atl_db_engine: "aurora_postgres"
+ atl_db_host: "aurora-postgres-db.ap-southeast-2.rds.amazonaws.com"
+ atl_jdbc_db_name: "confluence"
+ atl_jdbc_user: 'confluence'
+ atl_jvm_heap: 'PLACEHOLDER'
+ atl_cluster_node_id: 'FAKEID'
+ atl_autologin_cookie_age: "COOKIEAGE"
+ atl_local_ipv4: "1.1.1.1"
+
+ roles:
+ - role: linux_common
+ - role: product_common
+ - role: product_install
+ - role: confluence_common
+ - role: confluence_config
diff --git a/roles/confluence_config/molecule/aurora/tests/test_aurora.py b/roles/confluence_config/molecule/aurora/tests/test_aurora.py
new file mode 100644
index 0000000..bee0d38
--- /dev/null
+++ b/roles/confluence_config/molecule/aurora/tests/test_aurora.py
@@ -0,0 +1,68 @@
+import os
+import pytest
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
+
+def test_seraph_file(host):
+ f = host.file('/opt/atlassian/confluence/current/confluence/WEB-INF/classes/seraph-config.xml')
+ assert f.exists
+ assert f.contains('COOKIEAGE')
+
+def test_conf_init_file(host):
+ f = host.file('/opt/atlassian/confluence/current/confluence/WEB-INF/classes/confluence-init.properties')
+ assert f.exists
+ assert f.contains('confluence.home = /var/atlassian/application-data/confluence')
+
+def test_setenv_file(host):
+ f = host.file('/opt/atlassian/confluence/current/bin/setenv.sh')
+ assert f.exists
+ assert f.contains('-XmsPLACEHOLDER')
+ assert f.contains('-XmxPLACEHOLDER')
+ assert f.contains('-Dconfluence.cluster.node.name=1.1.1.1')
+
+def test_server_file(host):
+ f = host.file('/opt/atlassian/confluence/current/conf/server.xml')
+ assert f.exists
+ assert f.contains('Connector port="8080"')
+ assert f.contains('Server port="8005"')
+ assert f.contains('/media/atl/confluence/shared-home')
+ assert f.contains('org.postgresql.Driver')
+ assert f.contains('ec2.amazonaws.com')
+ assert f.contains('jdbc:postgresql://aurora-postgres-db.ap-southeast-2.rds.amazonaws.com:5432/confluence?targetServerType=master')
diff --git a/roles/confluence_config/molecule/default/playbook.yml b/roles/confluence_config/molecule/default/playbook.yml
index cb861b0..612f584 100644
--- a/roles/confluence_config/molecule/default/playbook.yml
+++ b/roles/confluence_config/molecule/default/playbook.yml
@@ -6,6 +6,9 @@
atl_product_edition: "confluence"
atl_product_user: "confluence"
atl_product_version: "latest"
+ atl_db_engine: "postgres"
+ atl_db_host: "postgres-db.ap-southeast-2.rds.amazonaws.com"
+ atl_jdbc_db_name: "confluence"
atl_jdbc_user: 'confluence'
atl_jvm_heap: 'PLACEHOLDER'
atl_cluster_node_id: 'FAKEID'
diff --git a/roles/confluence_config/molecule/default/tests/test_default.py b/roles/confluence_config/molecule/default/tests/test_default.py
index 4e0d444..a8d3013 100644
--- a/roles/confluence_config/molecule/default/tests/test_default.py
+++ b/roles/confluence_config/molecule/default/tests/test_default.py
@@ -65,3 +65,4 @@ def test_confluence_config_file(host):
assert f.contains('/media/atl/confluence/shared-home')
assert f.contains('org.postgresql.Driver')
assert f.contains('ec2.amazonaws.com')
+ assert f.contains('jdbc:postgresql://postgres-db.ap-southeast-2.rds.amazonaws.com:5432/confluence')