|
4 | 4 | ##############
|
5 | 5 |
|
6 | 6 | # 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 |
7 | 12 |
|
8 | 13 | - 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 |
10 | 15 | failed_when: false
|
11 | 16 | register: ant_installed
|
12 | 17 | changed_when: false
|
|
16 | 21 |
|
17 | 22 | - name: Download Apache Ant binaries
|
18 | 23 | 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 |
20 | 25 | dest: /tmp/
|
21 | 26 | mode: 0440
|
22 | 27 | timeout: 25
|
|
29 | 34 | tags: ant
|
30 | 35 |
|
31 | 36 | - 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 |
33 | 40 | when:
|
34 | 41 | - ant_installed.rc != 0
|
35 | 42 | - ansible_distribution == "MacOSX" or ansible_distribution == "Solaris"
|
|
44 | 51 | tags: ant
|
45 | 52 |
|
46 | 53 | - 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 }} |
48 | 55 | when: ant_installed.rc != 0
|
| 56 | + environment: |
| 57 | + PATH: "{{ ansible_env.PATH }}:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin" |
49 | 58 | tags: ant
|
50 | 59 |
|
51 | 60 | - name: Extract ant
|
52 | 61 | become: true
|
53 | 62 | unarchive:
|
54 |
| - src: /tmp/apache-ant-1.10.5-bin.zip |
| 63 | + src: /tmp/apache-ant-{{ ant_version }}-bin.zip |
55 | 64 | dest: /usr/local
|
56 | 65 | copy: false
|
57 | 66 | when:
|
|
69 | 78 | - name: Create /usr/local/bin/ant symlink
|
70 | 79 | become: true
|
71 | 80 | file:
|
72 |
| - src: /usr/local/apache-ant-1.10.5/bin/ant |
| 81 | + src: /usr/local/apache-ant-{{ ant_version }}/bin/ant |
73 | 82 | dest: /usr/local/bin/ant
|
74 | 83 | state: link
|
75 | 84 | when:
|
|
81 | 90 | path: "{{ item }}"
|
82 | 91 | state: absent
|
83 | 92 | with_items:
|
84 |
| - - /tmp/apache-ant-1.10.5-bin.zip |
| 93 | + - /tmp/apache-ant-{{ ant_version }}-bin.zip |
85 | 94 | when:
|
86 | 95 | - ant_installed.rc != 0
|
87 | 96 | failed_when: false
|
|
0 commit comments