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 1 commit
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
8 changes: 3 additions & 5 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ karaf_log_path: ${karaf.data}/log/

karaf_logging_template: org.ops4j.pax.logging.cfg

karaf_java_home: "{% if ansible_os_family == 'RedHat' %}/usr/lib/jvm/java-1.8.0-openjdk/{% else %}/usr/lib/jvm/java-8-openjdk-amd64{% endif %}"
karaf_java_home: /usr/lib/jvm/java-8-openjdk-amd64
Copy link
Contributor

Choose a reason for hiding this comment

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

Should all these variables be removed as they are now set in the various vars files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, since whatever value the have in defaults will get overridden by the vars value due to the include. (I think.)


karaf_java_packages_yum:
karaf_java_packages:
- java-1.8.0-openjdk
- java-1.8.0-openjdk-devel

karaf_java_packages_apt:
- openjdk-8-jre
- openjdk-8-jdk


karaf_systemd_template: karaf.service
16 changes: 5 additions & 11 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
---

- name: Make sure java packages are installed (apt)
apt:
name: "{{ karaf_java_packages_apt|join(',') }}"
state: present
update_cache: yes
when: ansible_os_family == "Debian"
- name: Include OS-specific variables
include_vars: "{{ ansible_os_family}}.yml"

- name: Make sure java packages are installed (yum)
yum:
name: "{{ karaf_java_packages_yum|join(',') }}"
- name: Install Java packages
package:
name: "{{ karaf_java_packages|join(',') }}"
state: present
update_cache: yes
when: ansible_os_family == "RedHat"

- name: Expand Karaf Tarball
unarchive:
Expand Down
5 changes: 0 additions & 5 deletions tasks/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
args:
chdir: "{{ karaf_install_symlink }}/bin"
creates: "{{ karaf_install_symlink }}/bin/karaf-wrapper"
environment:
JAVA_HOME: "{{ karaf_java_home }}"
KARAF_HOME: "{{ karaf_install_symlink }}"
become_user: "{{ karaf_user }}"
register: karaf_service_install

Expand All @@ -40,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
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/
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the / here extraneous or should the same variable in the Debian.yml have one on its end? Might be nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is probably extraneous. Both ubuntu and centos provisioned fine with the current settings. I can try removing it and testing centos again...


karaf_java_packages:
- java-1.8.0-openjdk
- java-1.8.0-openjdk-devel