Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding RedHat support for #1 #12

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ None.
Role Variables
--------------

The `java_packages` variable must be set to a list of the desired Java packages. For example:
There are two variable for the Debian and RedHat/Fedora based distributions. See
below for examples:

```yaml
java_packages:
- openjdk-6-jdk
- oracle-java7-installer
debian_java_packages:
- oracle-java8-installer
```

```yaml
redhat_java_packages:
- java-1.8.0-openjdk-devel
```

# Debian / Ubuntu
Expand All @@ -46,6 +51,7 @@ Valid packages for Fedora are:

- java-1.7.0-openjdk
- java-1.8.0-openjdk
- java-1.8.0-openjdk-devel

# Others

Expand Down
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
java_packages: []
debian_java_packages: []
redhat_java_packages: []
java_cleanup: True
2 changes: 1 addition & 1 deletion tasks/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

- name: Install Java packages
apt: pkg={{ item }} state=latest
with_items: java_packages
with_items: debian_java_packages

- name: Remove unwanted Java packages
apt: pkg={{ item }} state=absent
Expand Down
2 changes: 1 addition & 1 deletion tasks/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: Install Java packages
yum: name={{ item }} state=latest
with_items: java_packages
with_items: redhat_java_packages
when: ansible_os_family == 'RedHat'


Expand Down
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
- include: Debian.yml
when: ansible_os_family == 'Debian'
- include: RedHat.yml
when: ansible_os_family == 'RedHat'
2 changes: 1 addition & 1 deletion tests/group_vars/test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
java_packages:
debian_java_packages:
- oracle-java8-set-default
- oracle-java8-installer
- openjdk-6-jdk
2 changes: 1 addition & 1 deletion vars/Ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ java_packages_full:
#- openjdk-7-jre-headless:i386
#- openjdk-7-jre-zero
#- openjdk-7-jre-zero:i386
java_packages_to_remove: "{{ java_packages_full | difference(java_packages) }}"
java_packages_to_remove: "{{ java_packages_full | difference(debian_java_packages) }}"
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
java_needs_oracle: "{{ java_packages | join | search('oracle') }}"
java_needs_oracle: "{{ debian_java_packages | join | search('oracle') }}"