Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

install and setup on centos #1

Merged
merged 3 commits into from
Feb 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ karaf_log_path: ${karaf.data}/log/

karaf_logging_template: org.ops4j.pax.logging.cfg

karaf_java_home: /usr/lib/jvm/java-8-openjdk-amd64

karaf_java_packages:
- openjdk-8-jre
- openjdk-8-jdk

karaf_systemd_template: karaf.service

# The following variables have a default value depending on operating system.
# karaf_java_home: /usr/lib/jvm/java-8-openjdk-amd64
# karaf_java_packages:
# - java-1.8.0-openjdk
# - java-1.8.0-openjdk-devel
19 changes: 15 additions & 4 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
---

- name: Make sure java packages are installed
apt:
- name: Include OS-specific variables
include_vars: "{{ ansible_os_family}}.yml"

- name: Define karaf_java_home
set_fact:
karaf_java_home: "{{ __karaf_java_home }}"
when: karaf_java_home is not defined

- name: Define karaf_java_packages
set_fact:
karaf_java_packages: "{{ __karaf_java_packages }}"
when: karaf_java_packages is not defined

- name: Install Java packages
package:
name: "{{ karaf_java_packages|join(',') }}"
state: present
update_cache: yes

- name: Expand Karaf Tarball
unarchive:
Expand All @@ -29,4 +41,3 @@
dest: "{{ karaf_install_symlink }}"
owner: "{{ karaf_user }}"
group: "{{ karaf_user }}"

11 changes: 7 additions & 4 deletions tasks/service.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
---

- name: Copy setenv script
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? It runs fine for me in my testing without setting this on Cent 7.

Probably doesn't hurt to add, but just wondering why it was added.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we are masking some issues with the Blazegraph and Fedora roles by setting JAVA_HOME here then? Since it seems like Karaf starts fine without it...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I built the tasks based on the instructions in the Karaf Quick Guide which included this script. I simply included it because they did.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay cool. 👍🏻

Just wanted some detail why its there.

template:
src: setenv.j2
dest: "{{ karaf_install_symlink }}/bin/setenv"
owner: "{{ karaf_user }}"
group: "{{ karaf_user }}"

- name: Start Karaf
shell: >
JAVA_HOME={{ karaf_java_home }}
KARAF_HOME={{ karaf_install_symlink }}
{{ karaf_install_symlink }}/bin/start && sleep 5
args:
chdir: "{{ karaf_install_symlink }}/bin"
Expand Down Expand Up @@ -32,8 +37,6 @@

- name: Stop Karaf
shell: >
JAVA_HOME={{ karaf_java_home }}
KARAF_HOME={{ karaf_install_symlink }}
{{ karaf_install_symlink }}/bin/stop && sleep 1
args:
chdir: "{{ karaf_install_symlink }}/bin"
Expand Down
51 changes: 51 additions & 0 deletions templates/setenv.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
# handle specific scripts; the SCRIPT_NAME is exactly the name of the Karaf
# script: client, instance, shell, start, status, stop, karaf
#
# if [ "$KARAF_SCRIPT" == "SCRIPT_NAME" ]; then
# Actions go here...
# fi

#
# general settings which should be applied for all scripts go here; please keep
# in mind that it is possible that scripts might be executed more than once, e.g.
# in example of the start script where the start script is executed first and the
# karaf script afterwards.
#

#
# The following section shows the possible configuration options for the default
# karaf scripts
#
export JAVA_HOME={{karaf_java_home}} # Location of Java installation
# export JAVA_MIN_MEM # Minimum memory for the JVM
# export JAVA_MAX_MEM # Maximum memory for the JVM
# export JAVA_PERM_MEM # Minimum perm memory for the JVM
# export JAVA_MAX_PERM_MEM # Maximum perm memory for the JVM
# export EXTRA_JAVA_OPTS # Additional JVM options
export KARAF_HOME={{karaf_install_symlink}} # Karaf home folder
# export KARAF_DATA # Karaf data folder
# export KARAF_BASE # Karaf base folder
# export KARAF_ETC # Karaf etc folder
# export KARAF_OPTS # Additional available Karaf options
# export KARAF_DEBUG # Enable debug mode
# export KARAF_REDIRECT # Enable/set the std/err redirection when using bin/start
# export KARAF_NOROOT # Prevent execution as root if set to true
7 changes: 7 additions & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

__karaf_java_home: /usr/lib/jvm/java-8-openjdk-amd64

__karaf_java_packages:
- openjdk-8-jre
- openjdk-8-jdk
7 changes: 7 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

__karaf_java_home: /usr/lib/jvm/java-1.8.0-openjdk

__karaf_java_packages:
- java-1.8.0-openjdk
- java-1.8.0-openjdk-devel