diff --git a/aws_jira_dc_node.yml b/aws_jira_dc_node.yml index 135fcfc..4034d60 100644 --- a/aws_jira_dc_node.yml +++ b/aws_jira_dc_node.yml @@ -16,4 +16,3 @@ - jira_download - jira_config - jira_startup - diff --git a/roles/aws_common/tasks/main.yml b/roles/aws_common/tasks/main.yml index 166eb0b..c6cb279 100644 --- a/roles/aws_common/tasks/main.yml +++ b/roles/aws_common/tasks/main.yml @@ -3,6 +3,10 @@ - name: Install distro-specific prerequisites include_tasks: "{{ ansible_distribution|lower }}.yml" +- name: Use EC2 instance ID for cluster node ID + set_fact: + atl_cluster_node_id: "{{ ansible_ec2_instance_id }}" + - name: Fetch local EC2 metadata ec2_metadata_facts: # Guard is mostly for testing diff --git a/roles/jira_config/molecule/default/molecule.yml b/roles/jira_config/molecule/default/molecule.yml index 7f9d61a..92b5027 100644 --- a/roles/jira_config/molecule/default/molecule.yml +++ b/roles/jira_config/molecule/default/molecule.yml @@ -16,6 +16,8 @@ provisioner: skip-tags: runtime_pkg lint: name: ansible-lint + options: + x: ["701"] inventory: links: group_vars: ../../../../group_vars/ diff --git a/roles/jira_config/molecule/default/playbook.yml b/roles/jira_config/molecule/default/playbook.yml index 2637d7b..c5ca930 100644 --- a/roles/jira_config/molecule/default/playbook.yml +++ b/roles/jira_config/molecule/default/playbook.yml @@ -8,6 +8,7 @@ atl_product_version: "7.13.2" atl_jdbc_user: 'atljira' atl_jvm_heap: 'PLACEHOLDER' + atl_cluster_node_id: 'FAKEID' roles: - role: linux_common - role: product_common diff --git a/roles/jira_config/molecule/default/tests/test_default.py b/roles/jira_config/molecule/default/tests/test_default.py index 885cdfa..0588d7b 100644 --- a/roles/jira_config/molecule/default/tests/test_default.py +++ b/roles/jira_config/molecule/default/tests/test_default.py @@ -19,3 +19,9 @@ def test_setenv_file(host): assert f.exists assert f.contains('JVM_MINIMUM_MEMORY="PLACEHOLDER"') assert f.contains('JVM_MAXIMUM_MEMORY="PLACEHOLDER"') + +def test_cluster_file(host): + f = host.file('/var/atlassian/application-data/jira/cluster.properties') + assert f.exists + assert f.contains('jira.node.id = FAKEID') + assert f.contains('jira.shared.home = /media/atl/jira/shared') diff --git a/roles/jira_config/tasks/main.yml b/roles/jira_config/tasks/main.yml index d7a56c6..3f08170 100644 --- a/roles/jira_config/tasks/main.yml +++ b/roles/jira_config/tasks/main.yml @@ -1,11 +1,17 @@ --- -- name: Create dbconfig.xml +- name: Create database config template: src: dbconfig.xml.j2 dest: "{{ atl_product_home }}/dbconfig.xml" owner: "{{ atl_product_user }}" +- name: Create cluster config + template: + src: cluster.properties.j2 + dest: "{{ atl_product_home }}/cluster.properties" + owner: "{{ atl_product_user }}" + - name: Override JVM memory settings. # Ugly but necessary as the product installs this file so we need to make the change here. lineinfile: diff --git a/roles/jira_config/templates/cluster.properties.j2 b/roles/jira_config/templates/cluster.properties.j2 new file mode 100644 index 0000000..e3871c6 --- /dev/null +++ b/roles/jira_config/templates/cluster.properties.j2 @@ -0,0 +1,2 @@ +jira.node.id = {{ atl_cluster_node_id }} +jira.shared.home = {{ atl_product_home_shared }}