ee66686f8f3b9ab8658e40d68e36e7ae136e91d0
[yardstick.git] / ansible / roles / build_cni / 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: Get CNI driver sources
16   git:
17     repo: "{{ item.value.repo_url }}"
18     dest: "{{ cni_src_dir }}/{{ item.key }}"
19     version: "{{ item.value.repo_ver }}"
20   with_dict: "{{ cni_info }}"
21
22 - name: Compile CNI drivers
23   command: "{{ cni_src_dir }}/{{ item.key }}/{{ item.value.build_script }}"
24   environment: "{{ go_env }}"
25   args:
26     chdir: "{{ cni_src_dir }}/{{ item.key }}"
27   with_dict: "{{ cni_info }}"
28
29 - name: Get list of compiled CNI binaries
30   shell: ls -1 {{ item.key }}/bin/*
31   register: ls_cni_binaries_result
32   args:
33     chdir: "{{ cni_src_dir }}"
34   with_dict: "{{ cni_info }}"
35
36 - set_fact:
37     cni_binary_list: "{{ cni_binary_list|default([]) + item.stdout_lines }}"
38   with_items: "{{ ls_cni_binaries_result.results }}"
39
40 - name: Create CNI binaries dir
41   file: path={{ cni_bin_dir }} state=directory
42
43 - name: Copy CNI binaries into kublet bin dir
44   copy:
45     src: "{{ cni_src_dir }}/{{ item }}"
46     dest: "{{ cni_bin_dir }}/"
47     remote_src: yes
48     mode: 0755
49   with_items: "{{ cni_binary_list }}"