summaryrefslogtreecommitdiff
path: root/salt/openbook/ansible/files/openjdk.yaml
blob: 676386faecc15bbac21a77215451fb8605c72ef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
- name: "Install openjdk"
  hosts: target
  tasks:
    - name: "Update apt"
      apt:
        update_cache: yes
      when: ansible_distribution == "Ubuntu"

    - name: "Install openjdk package"
      apt:
        pkg: "{{ item }}"
        state: present
      with_items:
        - openjdk-8-jdk-headless
        - ca-certificates-java
      when: ansible_distribution == "Ubuntu"

    - name: "Update yum cache"
      yum:
        update_cache: yes
      when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS"

    - name: "Install openjdk package"
      yum:
        name: "{{ item }}"
        state: present
      with_items:
        - openjdk
      when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS"

    - name: "Install icedtea package"
      portage:
        name: "{{ item }}"
        state: present
      with_items:
        - dev-java/icedtea:8
      when: ansible_distribution == "Gentoo"

    - name: "Set icedtea-8 as default java"
      shell: java-config -S icedtea-8
      when: ansible_distribution == "Gentoo"

    - name: "/dev/urandom fix"
      lineinfile:
        dest: "/etc/java-8-openjdk/security/java.security"
        regexp: "{{ item.regexp }}"
        line: "{{ item.line }}"
      with_items:
        - { regexp: '^securerandom.source=file:/dev/random.*$', line: "securerandom.source=file:/dev/urandom" }
      when: ansible_distribution == "Ubuntu"

    - name: "/dev/urandom fix"
      lineinfile:
        dest: "/etc/java-config-2/current-system-vm/jre/lib/security/java.security"
        regexp: "{{ item.regexp }}"
        line: "{{ item.line }}"
      with_items:
        - { regexp: '^securerandom.source=file:/dev/random.*$', line: "securerandom.source=file:/dev/urandom" }
      when: ansible_distribution == "Gentoo"

    - name: "Ensure java root certs are packaged"
      shell: update-ca-certificates