Im trying to install the java jdk package on a windows salt-minion through a salt state file. On linux servers ive got it working fine with
packages_to_install:
pkg.installed:
- pkgs:
- java-11-openjdk.x86_64
For the windows servers however this config doesnt work. Trying to search the web for what else is needed has proved fruitless so far but im guessing i need to tell the state file where to download the java package from however i cant find what the setting should be.
CodePudding user response:
For windows installation you have two main options:
- Configure and use winrepo. Note that the default JDK installer is Oracle's, which you may not be licensed to use. Create your own software definition file to override.
Install JDK:
pkg.installed:
- name: jdk11
- Download and run an installer.
Download JDK installer:
file.managed:
- name: C:\Installers\java-11-openjdk.msi
- source: https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.17+8/OpenJDK11U-jdk_x64_windows_hotspot_11.0.17_8.msi
- source_hash: 9b74536f2475b67e53c83ecf41f80ac9f1ba29cef91c6e261e10d1223da42d69
- makedirs: true
- prereq:
- Install JDK
Install JDK:
cmd.run:
- name: msiexec /a C:\Installers\java-11-openjdk.msi
- unless: java -version | findstr 11.0.17