-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.yml
65 lines (56 loc) · 2.46 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
---
#######################################################
# ansible install into /usr/local from source tarball #
#######################################################
# Conditions:
# Check if target is installed
# Proceed with downloading to /tmp/src_tarball_extracted installing
- name: Test if already installed into "{{ installed_target }}"
stat: path="{{ installed_target }}"
register: local_installed
tags: local_srcinstall
- name: Check installed version if "{{ installed_target }}"
shell: "{{ installed_target }}" --version | head -1 | awk '{rint$NF}'
# No ignore_errors:yes here - if --version not supported it needs flagged
register: local_installedversion
when: ( srcinstall_version_required is defined and local_installed.stat.exists == True )
tags: local_srcinstall
- name: Download source tarball from "{{ src_tarball }}"
get_url:
url: "{{ src_tarball }}"
dest: /tmp/src_tarball.tgz
mode: 0440
when: local_installed.stat.exists == False or ( srcinstall_version_required is defined and local_installed_version is version("{{srcinstall_version_required}}", ">="))
tags: local_srcinstall
- name: Create temp directory to build in
file: path=/tmp/src_tarball_extracted state=directory
when: local_installed.stat.exists == False
tags: local_srcinstall
- name: Extract /tmp/src_tarball.tgz to /tmp/src_tarball_extracted
unarchive:
src: /tmp/src_tarball.tgz
dest: /tmp/src_tarball_extracted
copy: False
when: local_installed.stat.exists == False
tags: local_srcinstall
- name: Compile and install to "{{ installed_targetprefix | default('/usr/local') }}"
shell: cd /tmp/src_tarball_extracted/* && ./configure "{{ srcinstall_configure_params | default('--prefix=/usr/local') }}" && make clean && make -j {{ ansible_processor_vcpus }} && make install
when: local_installed.stat.exists == False
tags: local_srcinstall
- name: Remove /tmp/src_tarball.tgz and /tmp/src_tarball_extracted
file:
path: "{{ item }}"
state: absent
with_items:
- /tmp/src_tarball.tgz
- /tmp/src_tarball_extracted
when: local_installed.stat.exists == False
tags: local_srcinstall
- name: Create optional symlink from "{{ srcinstall_symlink_source }}" to "{{ srcinstall_symlink_target }}"
file:
src: "{{ srcinstall_symlink_source }}"
dest: "{{ srcinstall_symlink_target }}"
state: link
when:
- local_installed.stat.exists == False
- ( srcinstall_symlink_source is defined and srcinstall_symlink_target is defined )