DCD-1089: The systemd installation location depends on the OS.

This commit is contained in:
Steve Smith
2020-08-28 13:07:56 +10:00
parent 5bae465412
commit 657efb77ab
8 changed files with 24 additions and 7 deletions

View File

@@ -14,6 +14,11 @@ atl_startup_exec_path: "{{ atl_product_installation_current }}/{{ atl_startup_sc
atl_startup_exec_options: ["-fg"]
atl_startup_systemd_params: []
atl_systemd_service_dir_map:
amazon: "/usr/lib/systemd/system"
ubuntu: "/lib/systemd/system"
atl_systemd_service_dir: "{{ atl_systemd_service_dir_map[ansible_distribution|lower] }}"
atl_systemd_service_name: "{{ atl_product_edition }}.service"
atl_systemd_service_target: "multi-user.target"

View File

@@ -29,8 +29,11 @@
pre_tasks:
- name: Create systemd dir if necessary
file:
path: '/usr/lib/systemd/system/'
path: "{{ item }}"
state: directory
with_items:
- '/usr/lib/systemd/system/'
- '/lib/systemd/system/'
roles:
- role: product_startup

View File

@@ -7,7 +7,8 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
def test_service_file(host):
f = host.file('/usr/lib/systemd/system/bitbucket.service')
systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib"
f = host.file(systemd_prefix+'/systemd/system/bitbucket.service')
assert f.contains("^ExecStart=/opt/atlassian/bitbucket/current/bin/start-bitbucket.sh -fg --no-search$")
assert f.contains("^UMask=0027$")
assert f.contains("^LimitNOFILE=4096$")

View File

@@ -12,8 +12,11 @@
pre_tasks:
- name: Create systemd dir if necessary
file:
path: '/usr/lib/systemd/system/'
path: "{{ item }}"
state: directory
with_items:
- '/usr/lib/systemd/system/'
- '/lib/systemd/system/'
roles:
- role: product_startup

View File

@@ -7,7 +7,8 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
def test_service_file(host):
f = host.file('/usr/lib/systemd/system/jira-software.service')
systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib"
f = host.file(systemd_prefix+'/systemd/system/jira-software.service')
assert f.contains("^ExecStart=/opt/atlassian/jira-software/current/bin/start-jira.sh -fg$")
assert f.user == 'root'
assert f.group == 'root'

View File

@@ -20,8 +20,11 @@
pre_tasks:
- name: Create systemd dir if necessary
file:
path: '/usr/lib/systemd/system/'
path: "{{ item }}"
state: directory
with_items:
- '/usr/lib/systemd/system/'
- '/lib/systemd/system/'
roles:
- role: product_startup

View File

@@ -7,7 +7,8 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
def test_service_file(host):
f = host.file('/usr/lib/systemd/system/synchrony.service')
systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib"
f = host.file(systemd_prefix+'/systemd/system/synchrony.service')
assert f.contains("^ExecStart=/opt/atlassian/bin/start-synchrony$")
assert f.contains("^EnvironmentFile=/etc/atl$")
assert f.contains("^EnvironmentFile=/etc/atl.synchrony$")

View File

@@ -3,7 +3,7 @@
- name: "Install systemd service file"
template:
src: "product.service.j2"
dest: "/usr/lib/systemd/system/{{ atl_systemd_service_name }}"
dest: "{{ atl_systemd_service_dir }}/{{ atl_systemd_service_name }}"
owner: root
group: root
mode: 0640