-
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathmain.yml
More file actions
122 lines (107 loc) · 3.82 KB
/
Copy pathmain.yml
File metadata and controls
122 lines (107 loc) · 3.82 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
###########################
# Apache ANT Installation #
###########################
- name: Test if Ant {{ ant_version }} is already installed
win_stat:
path: 'C:\apache-ant\apache-ant-{{ ant_version }}'
register: ant_installed
tags: ANT
- name: Test if Ant is already downloaded
win_stat:
path: 'c:\temp\ant.zip'
register: ant_download
tags: ANT
- name: Download Apache ANT
win_get_url:
url: https://archive.apache.org/dist/ant/binaries/apache-ant-{{ ant_version }}-bin.zip
dest: c:\temp\ant.zip
force: no
checksum: "{{ ant_checksum }}"
checksum_algorithm: sha512
when: (not ant_installed.stat.exists) and (not ant_download.stat.exists)
register: ant_download
tags: ANT
- name: GPG Signature Verification of Binary
include_tasks:
file: ../../GPG_signature_verification/tasks/main.yml
vars:
file_path: c:/temp/ant.zip
signature_link: "https://archive.apache.org/dist/ant/binaries/apache-ant-{{ ant_version }}-bin.zip.asc"
GPG_key: "{{ key.apache_ant }}"
when: (not ant_installed.stat.exists)
tags: ANT
- name: Deploy Apache ANT
win_unzip:
src: c:\temp\ant.zip
dest: c:\apache-ant\
creates: c:\apache-ant
when: (not ant_installed.stat.exists)
tags: ANT
- name: Set ANT_HOME
raw: setx ANT_HOME "C:\apache-ant\apache-ant-{{ ant_version }}" /m
when: (not ant_installed.stat.exists)
tags: ANT
- name: Add %ANT_HOME%\bin to %PATH%
win_path:
elements:
- '%ANT_HOME%\bin'
state: present
when: (not ant_installed.stat.exists)
tags: ANT
- name: Test if ant-contrib is already installed
win_stat:
path: 'C:\apache-ant\apache-ant-{{ ant_version }}\lib\ant-contrib.jar'
register: ant_contrib_installed
tags: ANT
# NOTE: This is commented out and replaced with a manual invocation of sha256sum
# afterwards because this was not workin consistently. It is left here as
# we need further diagnosis to understand why this is not working.
# Specifically is it failing in the github actions run for build image gen
- name: Download ant-contrib with curl
win_shell: c:\cygwin64\bin\curl -Lo c:\temp\ant-contrib.zip https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip
#- name: Download ant-contrib
# win_get_url:
# url: https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip
# dest: c:\temp\ant-contrib.zip
# force: no
# checksum: 22bae6c3ddf1a464b285784599eef8698f64dde24378c77e42522a536b88cbbc
# checksum_algorithm: sha256
# when: (not ant_contrib_installed.stat.exists)
# tags: ANT
- name: "Check sha256sum of ant-contrib.zip with PowerShell"
win_shell: |
$filePath = "c:\temp\ant-contrib.zip"
$expectedChecksum = "22bae6c3ddf1a464b285784599eef8698f64dde24378c77e42522a536b88cbbc"
$actualChecksum = Get-FileHash -Path $filePath -Algorithm SHA256 | Select-Object -ExpandProperty Hash
if ($actualChecksum -ne $expectedChecksum) {
Write-Output "Checksum mismatch"
Write-Output "Actual Checksum: $actualChecksum"
Write-Output "Expect Checksum: $expectedChecksum"
exit 1
}
register: checksum_result
failed_when: checksum_result.rc != 0
- name: Unzip ant-contrib
win_unzip:
src: c:\temp\ant-contrib.zip
dest: c:\temp\ant-contrib
creates: c:\temp\ant-contrib
when: (not ant_contrib_installed.stat.exists)
tags: ANT
- name: "Copy the ant-contrib.jar to ANT's lib folder"
win_copy:
src: C:\temp\ant-contrib\ant-contrib\lib\ant-contrib.jar
dest: C:\apache-ant\apache-ant-{{ ant_version }}\lib\ant-contrib.jar
remote_src: True
when: (not ant_contrib_installed.stat.exists)
tags: ANT
- name: Clean up ant zip files
win_file:
path: "C:/temp/{{ item }}"
state: absent
with_items:
- ant-contrib.zip
- ant.zip
- ant-contrib.sha256
tags: ANT