Last active
March 30, 2023 03:15
-
-
Save renoirb/6722890 to your computer and use it in GitHub Desktop.
How to install Oracle Java from ppa webupd8team/java using Salt stack, in ONE state file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# How to install automatically Oracle Java 7 under Salt Stack | |
# | |
# Thanks Oracle for complicating things :( | |
# | |
# 1. Create a java/ folder in your salt master | |
# 2. Paste this file in init.sls | |
# 3. salt '*' state.sls java | |
# | |
# Source: | |
# * https://github.com/log0ymxm/salt-jvm/blob/master/init.sls | |
# * http://architects.dzone.com/articles/puppet-installing-oracle-java | |
# | |
oracle-ppa: | |
pkgrepo.managed: | |
- humanname: WebUpd8 Oracle Java PPA repository | |
- ppa: webupd8team/java | |
oracle-license-select: | |
cmd.run: | |
- unless: which java | |
- name: '/bin/echo /usr/bin/debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections' | |
- require_in: | |
- pkg: oracle-java7-installer | |
- cmd: oracle-license-seen-lie | |
oracle-license-seen-lie: | |
cmd.run: | |
- name: '/bin/echo /usr/bin/debconf shared/accepted-oracle-license-v1-1 seen true | /usr/bin/debconf-set-selections' | |
- require_in: | |
- pkg: oracle-java7-installer | |
oracle-java7-installer: | |
pkg: | |
- installed | |
- require: | |
- pkgrepo: oracle-ppa |
@JJ You should have python-software-properties
installed (it includes python-apt
). From Salt docs:
On Ubuntu systems, the python-software-properties package should be installed for better support of PPA repositories.
INFO ] Completed state [git] at time 23:40:59.970228 duration_in_ms=322.06
local:
----------
ID: git-deps
Function: pkg.installed
Name: git
Result: False
Comment: Failed to get virtual package information (E:Type 'oracle-ppa' is not known on line 16 in source list /etc/apt/sources.list)
Started: 23:40:59.648168
Duration: 322.06 ms
Changes:
Summary for local
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 322.060 ms
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
salt-call state.highstate --retcode-passthrough --log-level=info --force-color
Stdout from the command:
local:
----------
ID: git-deps
Function: pkg.installed
Name: git
Result: False
Comment: Failed to get virtual package information (E:Type 'oracle-ppa' is not known on line 16 in source list /etc/apt/sources.list)
Started: 23:40:59.648168
Duration: 322.06 ms
Changes:
Summary for local
In my case keyserver has been unavailable so I've used - keyserver: hkp://keyserver.ubuntu.com:80 which seems to got a problem fixed.
You might want to consider using prereq
, so the debconf selects only run when pkg.installed
is triggered, e.g.
https://github.com/felixhummel/saltstates/blob/master/java/oracle.sls
Thanks for sharing!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html ist says: