mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-13 00:13:09 -06:00
DCD-224: Add installation of the ServiceDesk OBR when specified version is "all" or "servicedesk".
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 }}"
|
||||
|
||||
@@ -9,3 +9,4 @@ rules:
|
||||
level: error
|
||||
line-length: disable
|
||||
truthy: disable
|
||||
trailing-spaces: false
|
||||
|
||||
@@ -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"
|
||||
|
||||
14
roles/jira_config/molecule/servicedesk/Dockerfile.j2
Normal file
14
roles/jira_config/molecule/servicedesk/Dockerfile.j2
Normal 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
|
||||
30
roles/jira_config/molecule/servicedesk/molecule.yml
Normal file
30
roles/jira_config/molecule/servicedesk/molecule.yml
Normal 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
|
||||
24
roles/jira_config/molecule/servicedesk/playbook.yml
Normal file
24
roles/jira_config/molecule/servicedesk/playbook.yml
Normal 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
|
||||
26
roles/jira_config/molecule/servicedesk/tests/test_default.py
Normal file
26
roles/jira_config/molecule/servicedesk/tests/test_default.py
Normal 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
|
||||
@@ -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"
|
||||
|
||||
@@ -11,5 +11,6 @@
|
||||
- jq
|
||||
- tar
|
||||
- curl
|
||||
- unzip
|
||||
- fontconfig
|
||||
- python-psycopg2
|
||||
|
||||
@@ -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 }}"
|
||||
|
||||
Reference in New Issue
Block a user