DCD-224: Add installation of the ServiceDesk OBR when specified version is "all" or "servicedesk".

This commit is contained in:
Steve Smith
2019-04-29 15:37:44 +10:00
parent 4d7201fd07
commit e32b439ce2
11 changed files with 154 additions and 1 deletions

View File

@@ -4,9 +4,19 @@
vars:
atl_product_family: "jira"
atl_product_edition: "jira-{{ lookup('env', 'ATL_PRODUCT_EDITION') | lower }}"
atl_product_user: "jira"
# FIXME: Slightly hacky workaround for specifying All or
# ServiceDesk; override to use Software and install plugins later.
atl_product_bundle: "{{ lookup('env', 'ATL_PRODUCT_EDITION') | lower }}"
bundle_map:
all: software
servicedesk: software
core: core
software: software
atl_product_edition: "jira-{{ bundle_map[atl_product_bundle] }}"
roles:
- linux_common
- aws_common

View File

@@ -18,6 +18,7 @@ atl_shared_mountpoint: "/media/atl"
atl_home_base: "/var/atlassian/application-data"
atl_product_home: "{{ atl_home_base }}/{{ atl_product_family }}"
atl_product_home_shared: "{{ atl_shared_mountpoint }}/{{ atl_product_family }}/shared"
atl_product_shared_plugins: "{{ atl_product_home_shared }}/plugins/installed-plugins"
atl_installation_base: "/opt/atlassian"
atl_product_installation_base: "{{ atl_installation_base }}/{{ atl_product_edition }}"

View File

@@ -9,3 +9,4 @@ rules:
level: error
line-length: disable
truthy: disable
trailing-spaces: false

View File

@@ -24,3 +24,6 @@ atl_tomcat_protocol: "HTTP/1.1"
atl_tomcat_redirectport: ""
atl_tomcat_scheme: "http"
atl_tomcat_secure: "false"
atl_servicedesk_latest_version_url: "https://marketplace.atlassian.com/rest/2/products/key/jira-servicedesk/versions/latest"
atl_servicedesk_download_file: "{{ atl_installer_temp }}/jira-servicedesk-{{ atl_servicedesk_version }}.obr"

View File

@@ -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

View File

@@ -0,0 +1,30 @@
---
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
inventory:
links:
group_vars: ../../../../group_vars/
verifier:
name: testinfra
lint:
name: flake8
enabled: false

View File

@@ -0,0 +1,24 @@
---
- name: Converge
hosts: all
vars:
atl_product_bundle: servicedesk
bundle_map:
all: software
servicedesk: software
core: core
software: software
atl_product_edition: "jira-{{ bundle_map[atl_product_bundle] }}"
atl_product_family: "jira"
atl_product_user: "jira"
atl_jdbc_user: 'atljira'
atl_jvm_heap: 'PLACEHOLDER'
atl_cluster_node_id: 'FAKEID'
roles:
- role: linux_common
- role: product_common
- role: product_download
- role: jira_config

View File

@@ -0,0 +1,26 @@
import os
import urllib.request
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_version_is_correct(host):
verfile = host.file('/media/atl/jira/shared/jira-software.version')
assert verfile.exists
assert verfile.content.decode("UTF-8").strip() == "8.1.0"
def test_is_downloaded(host):
installer = host.file('/opt/atlassian/tmp/jira-software.8.1.0.tar.gz')
assert installer.exists
assert installer.user == 'root'
def test_is_unpacked(host):
installer = host.file('/opt/atlassian/jira-software/8.1.0')
assert installer.exists
assert installer.is_directory
assert installer.user == 'jira'
assert installer.mode == 0o0755

View File

@@ -27,3 +27,44 @@
with_items:
- 'JVM_MINIMUM_MEMORY'
- 'JVM_MAXIMUM_MEMORY'
# FIXME: The following is a bit of a special-case for now; ideally we
# should convert this into a general plugin-installation task
# (esp. when we get to supporting Portfolio), but there's no use for ATM.
- name: Install ServiceDesk if required
block:
- name: Fetch the latest version data
set_fact:
atl_servicedesk_version_json: "{{ lookup('url', '{{ atl_servicedesk_latest_version_url }}') }}"
- name: Extract the latest version number
set_fact:
atl_servicedesk_version: "{{ atl_servicedesk_version_json.name }}"
- name: Extract the download url
set_fact:
atl_servicedesk_download_url: "{{ atl_servicedesk_version_json._embedded.artifact._links.binary.href }}"
- name: Download ServiceDesk
get_url:
url: "{{ atl_servicedesk_download_url }}"
dest: "{{ atl_servicedesk_download_file }}"
mode: 0640
force: false
- name: Extract the plugin to the shared plugin directory
command: /usr/bin/unzip -jn "{{ atl_servicedesk_download_file }}" "*.jar"
args:
chdir: "{{ atl_product_shared_plugins }}"
creates: "{{ atl_product_shared_plugins }}/*servicedesk*.jar"
warn: false
- name: Make plugins writable by the Jira user
file:
path: "{{ atl_product_shared_plugins }}"
owner: "{{ atl_product_user }}"
group: "{{ atl_product_user }}"
mode: 0750
recurse: true
when: atl_product_bundle == "servicedesk" or atl_product_bundle == "all"

View File

@@ -11,5 +11,6 @@
- jq
- tar
- curl
- unzip
- fontconfig
- python-psycopg2

View File

@@ -14,8 +14,10 @@
state: directory
mode: 0750
owner: "{{ atl_product_user }}"
group: "{{ atl_product_user }}"
with_items:
- "{{ atl_product_home }}"
- "{{ atl_installer_temp }}"
- "{{ atl_product_home_shared }}"
- "{{ atl_product_shared_plugins }}"
- "{{ atl_product_installation_base }}"