-
-
Notifications
You must be signed in to change notification settings - Fork 102
/
main.yml
103 lines (90 loc) · 3.44 KB
/
main.yml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
---
###############
# Ant-Contrib #
###############
# ANT_HOME/lib is: /usr/local/apache-ant-*/lib
- name: Set ant-contrib version
set_fact: antContribVersion=1.0b2
tags: ant-contrib
- name: Set ant_lib_dir variable for on {{ ansible_distribution }} {{ ansible_architecture }}
set_fact:
ant_lib_dir: /usr/local/apache-ant-1.10.5/lib
tags: ant-contrib
- name: "Print ant_lib_dir variable"
debug: var=ant_lib_dir
tags: ant-contrib
- name: Check if ant-contrib is already installed
stat:
path: "{{ ant_lib_dir }}/ant-contrib.jar"
register: antcontrib_status
tags: ant-contrib
- name: Download ant-contrib
get_url:
url: https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-{{ antContribVersion }}/ant-contrib-{{ antContribVersion }}-bin.tar.gz
dest: /tmp/
mode: 0440
timeout: 25
validate_certs: no
checksum: sha256:c9b8b1ca18b13e293688cafbd8990c940ca49104dbeefc242e5c3f8de271abdf
retries: 3
delay: 5
register: antContrib_download
until: antContrib_download is not failed
when:
- not antcontrib_status.stat.exists
- ansible_distribution != "MacOSX"
- ansible_distribution != "Solaris"
- not (ansible_distribution == "CentOS" and ansible_distribution_major_version == "6")
tags: ant-contrib
# Use wget instead of ansible's get_url for Centos 6 https://github.com/adoptium/infrastructure/issues/2486
- name: Download ant-contrib (CentOS 6)
command: wget https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-{{ antContribVersion }}/ant-contrib-{{ antContribVersion }}-bin.tar.gz -O /tmp/ant-contrib-{{ antContribVersion }}-bin.tar.gz
retries: 3
delay: 5
register: antContrib_download
until: antContrib_download is not failed
when:
- not antcontrib_status.stat.exists
- ansible_distribution == "CentOS" and ansible_distribution_major_version == "6"
tags: ant-contrib
- name: Verify sha256 checksum of download (CentOS 6)
stat:
path: /tmp/ant-contrib-{{ antContribVersion }}-bin.tar.gz
checksum_algorithm: sha256
get_checksum: yes
register: antcontrib_checksum
failed_when: antcontrib_checksum.stat.checksum != 'c9b8b1ca18b13e293688cafbd8990c940ca49104dbeefc242e5c3f8de271abdf'
when:
- not antcontrib_status.stat.exists
- ansible_distribution == "CentOS" and ansible_distribution_major_version == "6"
tags: ant-contrib
- name: Download ant-contrib (macOS) and (Solaris)
command: wget https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-{{ antContribVersion }}/ant-contrib-{{ antContribVersion }}-bin.tar.gz -O /tmp/ant-contrib-{{ antContribVersion }}-bin.tar.gz
retries: 3
delay: 5
register: antContrib_download
until: antContrib_download is not failed
when:
- not antcontrib_status.stat.exists
- ansible_distribution == "MacOSX" or ansible_distribution == "Solaris"
tags: ant-contrib
- name: Extract ant-contrib
unarchive:
src: /tmp/ant-contrib-{{ antContribVersion }}-bin.tar.gz
dest: /tmp/
copy: False
when: not antcontrib_status.stat.exists
tags: ant-contrib
- name: Move ant-contrib.jar to ant lib folder
command: mv /tmp/ant-contrib/lib/ant-contrib.jar {{ ant_lib_dir }}
when: not antcontrib_status.stat.exists
tags: ant-contrib
- name: Remove downloaded packages for ant-contrib
file:
path: "{{ item }}"
state: absent
with_items:
- /tmp/ant-contrib
- /tmp/ant-contrib-{{ antContribVersion }}-bin.tar.gz
failed_when: false
tags: ant-contrib