diff --git a/aws_bitbucket_mesh_node.yml b/aws_bitbucket_mesh_node.yml new file mode 100644 index 0000000..1957b1a --- /dev/null +++ b/aws_bitbucket_mesh_node.yml @@ -0,0 +1,16 @@ +--- +- hosts: aws_node_local + become: true + + vars: + # See group_vars/aws_node_local.yml, which pull vars from the environment. + atl_product_family: "stash" + atl_product_edition: "bitbucket" + atl_product_user: "bitbucket" + + + roles: + - role: linux_common + - role: aws_common + - role: product_common + - role: bitbucket_mesh diff --git a/roles/bitbucket_mesh/defaults/main.yml b/roles/bitbucket_mesh/defaults/main.yml new file mode 100644 index 0000000..cb3e292 --- /dev/null +++ b/roles/bitbucket_mesh/defaults/main.yml @@ -0,0 +1,3 @@ +mesh_install_dir: /opt/atlassian/mesh +bitbucket_mesh_maven_repo: https://packages.atlassian.com/maven-external +bitbucket_mesh_version: "1.3.1" \ No newline at end of file diff --git a/roles/bitbucket_mesh/tasks/main.yml b/roles/bitbucket_mesh/tasks/main.yml new file mode 100644 index 0000000..ce1b820 --- /dev/null +++ b/roles/bitbucket_mesh/tasks/main.yml @@ -0,0 +1,51 @@ +--- + +- name: set up the bitbucket mesh group + ansible.builtin.group: + name: "{{ atl_product_user }}" + gid: 1001 + state: present + +- name: set up the bitbucket mesh user + ansible.builtin.user: + name: "{{ atl_product_user }}" + uid: 1001 + state: present + comment: "mesh_runtime_user" + groups: "{{ atl_product_user }}" + home: "{{ mesh_install_dir }}" + +- name: Create Bitbucket dirs if necessary + ansible.builtin.file: + path: "{{ item }}" + owner: "{{ atl_product_user }}" + group: "{{ atl_product_user }}" + mode: 0750 + state: directory + with_items: + - "{{ atl_home_base }}/{{ atl_product_edition }}" + - "{{ mesh_install_dir }}" + +- name: Template out the mesh service file + ansible.builtin.template: + src: mesh.service.j2 + dest: "/usr/lib/systemd/system/mesh.service" + owner: "root" + group: "root" + mode: 0740 + +- name: download the mesh distribution using maven + community.general.maven_artifact: + group_id: "com.atlassian.bitbucket.mesh" + artifact_id: "mesh-distribution" + extension: "tar.gz" + repository_url: "{{ bitbucket_mesh_maven_repo }}" + dest: "{{ mesh_install_dir }}" + mode: "0644" + owner: "{{ atl_product_user }}" + group: "{{ atl_product_user }}" + register: maven_download + +- name: debug + debug: + var: maven_download \ No newline at end of file diff --git a/roles/bitbucket_mesh/templates/mesh.service.j2 b/roles/bitbucket_mesh/templates/mesh.service.j2 new file mode 100644 index 0000000..f95a22c --- /dev/null +++ b/roles/bitbucket_mesh/templates/mesh.service.j2 @@ -0,0 +1,26 @@ +[Unit] +Description=Atlassian bitbucket-mesh +After=syslog.target network-online.target + +[Service] +Type=forking +UMask=0027 +User={{ atl_product_user }} +Group={{ atl_product_user }} +StandardOutput=journal+console +StandardError=journal+console +LimitNOFILE=65336 +Environment=MESH_HOME={{ atl_home_base }}/{{ atl_product_edition }} +Environment=JAVA_HOME=/usr/lib/jvm/java +Environment=JRE_HOME=/usr/lib/jvm/java +Environment=JMX_REMOTE_AUTH=password +Environment=JMX_PASSWORD_FILE=/var/atlassian/application-data/jmx/jmx.access +Environment="JVM_SUPPORT_RECOMMENDED_ARGS=-Dmesh.enabled=true -Dplugin.bitbucket-git.mesh.sidecar.child-process=false -Dcom.sun.management.jmxremote.port=4444 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath={{ atl_home_base }}/{{ atl_product_edition }}/log" +Environment=JVM_MAXIMUM_MEMORY={{ atl_jvm_heap }} +PIDFile={{ atl_home_base }}/{{ atl_product_edition }}/log/mesh.pid +PassEnvironment=JMX_REMOTE_AUTH JMX_PASSWORD_FILE JAVA_HOME +ExecStart={{ mesh_install_dir }}/current/bin/start-mesh.sh +ExecStop={{ mesh_install_dir }}/current/bin/stop-mesh.sh + +[Install] +WantedBy=multi-user.target \ No newline at end of file