diff --git a/roles/confluence_config/molecule/default/tests/test_default.py b/roles/confluence_config/molecule/default/tests/test_default.py index a8d3013..16c0a94 100644 --- a/roles/confluence_config/molecule/default/tests/test_default.py +++ b/roles/confluence_config/molecule/default/tests/test_default.py @@ -16,6 +16,16 @@ def test_conf_init_file(host): assert f.exists assert f.contains('confluence.home = /var/atlassian/application-data/confluence') +def test_conf_attachment_symlinks(host): + assert host.file('/var/atlassian/application-data/confluence').is_directory + assert host.file('/media/atl/confluence/shared-home/attachments/').is_directory + + f = host.file('/var/atlassian/application-data/confluence/attachments') + assert f.is_symlink and f.linked_to == '/media/atl/confluence/shared-home/attachments' + + f = host.file('/var/atlassian/application-data/confluence/shared-home') + assert f.is_symlink and f.linked_to == '/media/atl/confluence/shared-home' + def test_setenv_file(host): f = host.file('/opt/atlassian/confluence/current/bin/setenv.sh') assert f.exists diff --git a/roles/confluence_config/tasks/main.yml b/roles/confluence_config/tasks/main.yml index f1e69fc..80473c8 100644 --- a/roles/confluence_config/tasks/main.yml +++ b/roles/confluence_config/tasks/main.yml @@ -10,9 +10,27 @@ with_items: - "{{ atl_product_home }}" - "{{ atl_product_home_shared }}" + - "{{ atl_product_home_shared }}/attachments" - "{{ atl_product_shared_plugins }}" changed_when: false # For Molecule idempotence check +# Create symlink to force single (unclustered) Confluence to store +# shared-data and attachments in the shared drive. +- name: Symlink local attachments to shared storage + file: + src: "{{ item.0 }}" + dest: "{{ item.1 }}" + force: false + state: link + mode: 0750 + owner: "{{ atl_product_user }}" + group: "{{ atl_product_user }}" + vars: + - links: + - ["{{ atl_product_home_shared }}/", "{{ atl_product_home }}/shared-home"] + - ["{{ atl_product_home_shared }}/attachments/", "{{ atl_product_home }}/attachments"] + with_nested: + - "{{ links }}" - name: Create Tomcat server config template: