5489fadae61074f5465fa03966c827c1b555e6e3
[yardstick.git] / ansible / roles / install_go / tasks / main.yml
1 # Copyright (c) 2018-2019 Intel Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 ---
15 - name: Add go language gophers repo key
16   # due to a proxy issue in the ansible apt_key module on Ubuntu 17.10,
17   # it doesn't work to add key via `id` and `keyserver` parametes. Similar
18   # issue is described here: https://github.com/debops/ansible-elastic_co/issues/2
19   #  apt_key:
20   #    keyserver: "{{ golang_repo_key_server }}"
21   #    id: "{{ golang_repo_key_id }}"
22   # As a workaround, we can use `apt-key` tool directly with proxy specified.
23   command: >
24            apt-key adv --keyserver {{ golang_repo_key_server }} --recv-keys
25            --keyserver-options http-proxy={{ proxy_env.http_proxy }}
26            {{ golang_repo_key_id }}
27
28 - name: Add apt golang repository
29   apt_repository:
30     repo: "{{ golang_repo_url }}"
31     filename: golang-1.10-go
32
33 - name: Install golang-1.10-go
34   apt:
35     name: golang-1.10-go
36
37 - name: Setup Go environment variable
38   set_fact:
39     go_env:
40       PATH: "{{ golang_bin_dir }}:{{ ansible_env.PATH }}"