|
16 | 16 | - maven_test |
17 | 17 | - gradle_test |
18 | 18 |
|
19 | | -- name: What java8_rpms |
20 | | - when: ansible_os_family == 'RedHat' |
21 | | - debug: |
22 | | - msg: "{{ java8_rpms }}" |
23 | | - |
24 | | -- name: Ensure Java is installed. |
25 | | - when: ansible_os_family == 'RedHat' |
26 | | - yum: |
27 | | - name: "{{ java8_rpms }}" |
28 | | - state: present |
29 | | - register: network_access |
30 | | - until: network_access is success |
31 | | - retries: 10 |
32 | | - delay: 2 |
33 | | - |
34 | | -- name: Ensure file is installed for tests |
35 | | - when: ansible_os_family == 'RedHat' |
36 | | - yum: |
37 | | - name: file |
38 | | - state: present |
39 | | - register: network_access |
40 | | - until: network_access is success |
41 | | - retries: 10 |
42 | | - delay: 2 |
43 | | - |
44 | | -- name: What java8_apt |
45 | | - when: ansible_os_family == 'Debian' |
46 | | - debug: |
47 | | - msg: "{{ java8_apt }}" |
48 | 19 |
|
49 | 20 | - name: Ensure python-apt is installed. |
50 | 21 | when: ansible_os_family == 'Debian' |
|
53 | 24 | state: present |
54 | 25 | register: network_access |
55 | 26 | until: network_access is success |
56 | | - retries: 10 |
57 | | - delay: 2 |
| 27 | + retries: 3 |
| 28 | + delay: 3 |
58 | 29 |
|
59 | 30 | - name: Update apt cache. |
60 | 31 | when: ansible_os_family == 'Debian' |
|
63 | 34 | cache_valid_time: 86400 |
64 | 35 | register: network_access |
65 | 36 | until: network_access is success |
66 | | - retries: 10 |
67 | | - delay: 2 |
| 37 | + retries: 3 |
| 38 | + delay: 3 |
68 | 39 | tags: |
69 | 40 | - java8 |
70 | 41 | - java8_install |
71 | 42 |
|
72 | | -- name: Ensure Java is installed. |
73 | | - when: ansible_os_family == 'Debian' |
74 | | - apt: |
75 | | - name: "{{ java8_apt }}" |
| 43 | +- name: Which java packages to install |
| 44 | + include_vars: "{{ ansible_os_family }}{{ ansible_distribution_major_version }}.yml" |
| 45 | + tags: |
| 46 | + - java8 |
| 47 | + - java9 |
| 48 | + - java11 |
| 49 | + - java13 |
| 50 | + |
| 51 | +- name: Ensure Java8 is installed |
| 52 | + when: |
| 53 | + - java8_packages is defined |
| 54 | + - java8_packages|length |
| 55 | + package: |
| 56 | + name: "{{ java8_packages }}" |
| 57 | + state: present |
| 58 | + register: network_access |
| 59 | + until: network_access is success |
| 60 | + retries: 3 |
| 61 | + delay: 3 |
| 62 | + tags: |
| 63 | + - java8 |
| 64 | + |
| 65 | +- name: Ensure Java9 is installed |
| 66 | + when: |
| 67 | + - java9_packages is defined |
| 68 | + - java9_packages|length |
| 69 | + package: |
| 70 | + name: "{{ java9_packages }}" |
| 71 | + state: present |
| 72 | + register: network_access |
| 73 | + until: network_access is success |
| 74 | + retries: 3 |
| 75 | + delay: 3 |
| 76 | + tags: |
| 77 | + - java9 |
| 78 | + |
| 79 | +- name: Ensure Java11 is installed |
| 80 | + when: |
| 81 | + - java11_packages is defined |
| 82 | + - java11_packages|length |
| 83 | + package: |
| 84 | + name: "{{ java11_packages }}" |
| 85 | + state: present |
| 86 | + register: network_access |
| 87 | + until: network_access is success |
| 88 | + retries: 3 |
| 89 | + delay: 3 |
| 90 | + tags: |
| 91 | + - java11 |
| 92 | + |
| 93 | +- name: Ensure epel-release is installed |
| 94 | + when: |
| 95 | + - java_latest_packages is defined |
| 96 | + - java_latest_packages|length |
| 97 | + yum: |
| 98 | + name: epel-release |
| 99 | + state: present |
| 100 | + register: network_access |
| 101 | + until: network_access is success |
| 102 | + retries: 3 |
| 103 | + delay: 3 |
| 104 | + tags: |
| 105 | + - java13 |
| 106 | + |
| 107 | +- name: Ensure Java-latest is installed |
| 108 | + when: |
| 109 | + - java_latest_packages is defined |
| 110 | + - java_latest_packages|length |
| 111 | + package: |
| 112 | + name: "{{ java_latest_packages }}" |
| 113 | + state: present |
| 114 | + register: network_access |
| 115 | + until: network_access is success |
| 116 | + retries: 3 |
| 117 | + delay: 3 |
| 118 | + tags: |
| 119 | + - java13 |
| 120 | + |
| 121 | +- name: Correct java alternatives selected |
| 122 | + when: |
| 123 | + - ansible_os_family == 'RedHat' |
| 124 | + - ansible_distribution_major_version|int >= 7 |
| 125 | + alternatives: |
| 126 | + link: "/usr/bin/{{ item }}" |
| 127 | + name: "{{ item }}" |
| 128 | + path: "/usr/lib/jvm/{{ base_jdk }}/bin/{{ item }}" |
| 129 | + with_items: |
| 130 | + - java |
| 131 | + - javac |
| 132 | + tags: |
| 133 | + - alternatives |
| 134 | + - java11 |
| 135 | + |
| 136 | +- name: Correct tools alternatives selected |
| 137 | + when: |
| 138 | + - ansible_os_family == 'RedHat' |
| 139 | + - ansible_distribution_major_version|int >= 7 |
| 140 | + alternatives: |
| 141 | + link: "/etc/alternatives/{{ item }}" |
| 142 | + name: "{{ item }}" |
| 143 | + path: "/usr/lib/jvm/{{ base_jdk }}/bin/{{ item }}" |
| 144 | + with_items: |
| 145 | + - jar |
| 146 | + - jarsigner |
| 147 | + - javadoc |
| 148 | + - javap |
| 149 | + - jcmd |
| 150 | + - jconsole |
| 151 | + - jdb |
| 152 | + - jdeps |
| 153 | + - jinfo |
| 154 | + - jjs |
| 155 | + - jmap |
| 156 | + - jps |
| 157 | + - jrunscript |
| 158 | + - jstack |
| 159 | + - jstat |
| 160 | + - jstatd |
| 161 | + - keytool |
| 162 | + - pack200 |
| 163 | + - rmic |
| 164 | + - rmid |
| 165 | + - rmiregistry |
| 166 | + - serialver |
| 167 | + - unpack200 |
| 168 | + tags: |
| 169 | + - alternatives |
| 170 | + - java11 |
| 171 | + |
| 172 | +- name: Ensure file is installed for tests |
| 173 | + when: ansible_os_family == 'RedHat' |
| 174 | + yum: |
| 175 | + name: file |
76 | 176 | state: present |
77 | 177 | register: network_access |
78 | 178 | until: network_access is success |
79 | | - retries: 10 |
80 | | - delay: 2 |
| 179 | + retries: 3 |
| 180 | + delay: 3 |
81 | 181 |
|
82 | 182 | - name: Make sure java_top exists |
83 | 183 | become: yes |
|
0 commit comments