-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.yml
More file actions
178 lines (157 loc) · 5.28 KB
/
main.yml
File metadata and controls
178 lines (157 loc) · 5.28 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
---
- name: Gather os specific variables
include_vars: "{{ item }}"
with_first_found:
- files:
- "vars/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "vars/{{ ansible_os_family }}.yml"
skip: true
tags: vars
- name: singularity | Uninstall singularity
package:
state: absent
name: singularity
- name: singularity | install software base
package:
state: present
name: "{{ singularity_software_base }}"
register: _install_result
until: _install_result is success
retries: 10
delay: 2
- name: singularity | check Go dependencies installed
command: 'bash -c "go list github.com/golang/dep"'
environment:
PATH: '{{ golang_install_dir }}/bin:{{ ansible_env.PATH }}'
GOROOT: '{{ golang_install_dir }}'
GOPATH: '{{ golang_gopath }}'
register: go_installed
changed_when: false
failed_when: false
- name: singularity | get older go installation(s)
find:
paths: /opt/go/
file_type: directory
use_regex: true
patterns: ['^(?!{{ golang_version }})1.[0-9]{1,2}(.[0-9]{1,2}|)$']
register: older_go_versions
when: only_one_go_version
- name: singularity | remove older Go installation(s)
file:
path: '{{ item.path }}'
state: absent
with_items: "{{ older_go_versions.files }}"
when: only_one_go_version
- name: singularity | get Go version
command: go version
environment:
PATH: '{{ golang_install_dir }}/bin:{{ ansible_env.PATH }}'
GOROOT: '{{ golang_install_dir }}'
GOPATH: '{{ golang_gopath }}'
register: go_versions
changed_when: false
- name: singularity | display Go version
debug:
var: go_versions
environment:
PATH: '{{ golang_install_dir }}/bin:{{ ansible_env.PATH }}'
GOROOT: '{{ golang_install_dir }}'
GOPATH: '{{ golang_gopath }}'
# - name: singularity | install Go dependencies - GO111MODULE=off
# command: go env -w GO111MODULE=off
# environment:
# PATH: '{{ golang_install_dir }}/bin:{{ ansible_env.PATH }}'
# GOROOT: '{{ golang_install_dir }}'
# GOPATH: '{{ golang_gopath }}'
# when:
# - not ansible_check_mode
# - go_installed.rc == 1
- name: singularity | install Go dependencies
command: "go install -v github.com/golang/dep/cmd/dep@{{ go_dep_version }}"
environment:
PATH: '{{ golang_install_dir }}/bin:{{ ansible_env.PATH }}'
GOROOT: '{{ golang_install_dir }}'
GOPATH: '{{ golang_gopath }}'
when:
- not ansible_check_mode
- go_installed.rc == 1
- name: singularity | create directory for singularity
file:
path: "{{ golang_install_dir }}/src/github.com/sylabs/"
recurse: true
- name: singularity | clone the Singularity repository
git:
repo: https://github.com/sylabs/singularity.git
version: v{{ singularity_version }}
dest: "{{ golang_install_dir }}/src/github.com/sylabs/singularity"
- name: singularity | check singularity installed version
command: 'bash -c "singularity --version | grep \"{{ singularity_version }}\""'
register: singularity_installed_version
environment:
PATH: '/usr/local/bin/:{{ ansible_env.PATH }}'
changed_when: false
failed_when: false
- name: singularity | display singularity installed version
debug:
var: singularity_installed_version
when: singularity_role_debug
- name: singularity | compile the Singularity binary | mconfig
command: ./mconfig
args:
chdir: "{{ golang_install_dir }}/src/github.com/sylabs/singularity"
environment:
PATH: '{{ golang_install_dir }}/bin:{{ ansible_env.PATH }}'
GOROOT: '{{ golang_install_dir }}'
GOPATH: '{{ golang_gopath }}'
when:
- not ansible_check_mode
- singularity_installed_version.rc == 1
- name: singularity | compile the Singularity binary | make
make:
chdir: "{{ golang_install_dir }}/src/github.com/sylabs/singularity/builddir"
environment:
PATH: '{{ golang_install_dir }}/bin:{{ ansible_env.PATH }}'
GOROOT: '{{ golang_install_dir }}'
GOPATH: '{{ golang_gopath }}'
register: singularity_make
when:
- not ansible_check_mode
- singularity_installed_version.rc == 1
- name: singularity | debug make
debug:
var: singularity_make
when: singularity_role_debug
- name: singularity | compile the Singularity binary | make install
make:
target: install
chdir: "{{ golang_install_dir }}/src/github.com/sylabs/singularity/builddir"
environment:
PATH: '{{ golang_install_dir }}/bin:{{ ansible_env.PATH }}'
GOROOT: '{{ golang_install_dir }}'
GOPATH: '{{ golang_gopath }}'
register: singularity_make_install
when:
- not ansible_check_mode
- singularity_installed_version.rc == 1
- name: singularity | debug make install
debug:
var: singularity_make_install
when: singularity_role_debug
- name: singularity | check singularity installed version
command: 'singularity --version | grep "{{ singularity_version }}"'
environment:
PATH: '/usr/local/bin/:{{ ansible_env.PATH }}'
register: singularity_installed_version
changed_when: false
# failed_when: false
- name: singularity | display singularity installed version
debug:
var: singularity_installed_version
when: singularity_role_debug
- name: singularity | config bind bind_path
lineinfile:
path: "{{ singularity_conf_path }}"
line: 'bind path = {{ item }}'
create: true
backup: true
with_items: "{{ bind_paths | default([]) }}"