paulbsd-salt/states/java/install.sls
2023-03-31 17:22:18 +02:00

48 lines
1.2 KiB
Plaintext

---
{%- from "java/map.jinja" import java with context %}
java-directory:
file.directory:
- name: {{ java.install_dir }}
- user: root
- group: root
- dir_mode: 755
- file_mode: 644
java-extract:
archive.extracted:
- name: {{ java.install_dir }}
- source: {{ java.fetch_url }}/jdk-{{ java.version }}_{{ java.os }}-{{ java.arch }}_bin.tar.gz
- user: root
- group: root
- skip_verify: true
- if_missing: {{ java.install_dir }}/jdk-{{ java.version }}
java-link:
file.symlink:
- name: {{ java.install_dir }}/default
- target: {{ java.install_dir }}/jdk-{{ java.version }}
- force: true
- user: root
- group: root
- require:
- archive: java-extract
java-update-alternatives-script:
file.managed:
- name: {{ java.install_dir }}/default/update-alternatives-java.sh
- source: salt://java/templates/update-alternatives-java.sh.j2
- template: jinja
- user: root
- group: root
- mode: 755
- require:
- archive: java-extract
java-default:
cmd.run:
- name: {{ java.install_dir }}/default/update-alternatives-java.sh
- stateful: True
- require:
- archive: java-extract
- file: java-update-alternatives-script