Skip to content

Commit 02c0534

Browse files
committed
unixPB: improves download and verify of ant binary
by replacing `command: wget` with `get_url` module, it helps to support more systems. Also while running `GPG Signature verification` some systems (e.g old mac machines) have problem with wget while running `package_signature_verification.sh`. This change makes sure all systems will find wget in their `PATH`. Also makes `ant_version` a facts sat by default to `1.10.5` unless it is provided. Sigend-off-by: [email protected]
1 parent d483066 commit 02c0534

File tree

1 file changed

+16
-7
lines changed
  • ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/ant/tasks

1 file changed

+16
-7
lines changed

ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/ant/tasks/main.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
##############
55

66
# Install Apache Ant from binaries on RHEL and Centos
7+
- name: Set default Ant version if not provided
8+
set_fact:
9+
ant_version: "{{ ant_version | default('1.10.5') }}"
10+
tags:
11+
- ant
712

813
- name: Check if Apache Ant is already installed in custom location /usr/local
9-
shell: ls /usr/local/apache-ant-1.10.5 >/dev/null 2>&1
14+
shell: ls /usr/local/apache-ant-{{ ant_version }} >/dev/null 2>&1
1015
failed_when: false
1116
register: ant_installed
1217
changed_when: false
@@ -16,7 +21,7 @@
1621

1722
- name: Download Apache Ant binaries
1823
get_url:
19-
url: https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.5-bin.zip
24+
url: https://archive.apache.org/dist/ant/binaries/apache-ant-{{ ant_version }}-bin.zip
2025
dest: /tmp/
2126
mode: 0440
2227
timeout: 25
@@ -29,7 +34,9 @@
2934
tags: ant
3035

3136
- name: Download Apache Ant binaries (macOS) and (Solaris)
32-
command: wget https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.5-bin.zip -O /tmp/apache-ant-1.10.5-bin.zip
37+
get_url:
38+
url: https://archive.apache.org/dist/ant/binaries/apache-ant-{{ ant_version }}-bin.zip
39+
dest: /tmp/apache-ant-{{ ant_version }}-bin.zip
3340
when:
3441
- ant_installed.rc != 0
3542
- ansible_distribution == "MacOSX" or ansible_distribution == "Solaris"
@@ -44,14 +51,16 @@
4451
tags: ant
4552

4653
- name: GPG Signature verification
47-
script: ../Supporting_Scripts/package_signature_verification.sh -f /tmp/apache-ant-1.10.5-bin.zip -sl "https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.5-bin.zip.asc" -k {{ key.apache_ant }}
54+
script: ../Supporting_Scripts/package_signature_verification.sh -f /tmp/apache-ant-{{ ant_version }}-bin.zip -sl "https://archive.apache.org/dist/ant/binaries/apache-ant-{{ ant_version }}-bin.zip.asc" -k {{ key.apache_ant }}
4855
when: ant_installed.rc != 0
56+
environment:
57+
PATH: "{{ ansible_env.PATH }}:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin"
4958
tags: ant
5059

5160
- name: Extract ant
5261
become: true
5362
unarchive:
54-
src: /tmp/apache-ant-1.10.5-bin.zip
63+
src: /tmp/apache-ant-{{ ant_version }}-bin.zip
5564
dest: /usr/local
5665
copy: false
5766
when:
@@ -69,7 +78,7 @@
6978
- name: Create /usr/local/bin/ant symlink
7079
become: true
7180
file:
72-
src: /usr/local/apache-ant-1.10.5/bin/ant
81+
src: /usr/local/apache-ant-{{ ant_version }}/bin/ant
7382
dest: /usr/local/bin/ant
7483
state: link
7584
when:
@@ -81,7 +90,7 @@
8190
path: "{{ item }}"
8291
state: absent
8392
with_items:
84-
- /tmp/apache-ant-1.10.5-bin.zip
93+
- /tmp/apache-ant-{{ ant_version }}-bin.zip
8594
when:
8695
- ant_installed.rc != 0
8796
failed_when: false

0 commit comments

Comments
 (0)