NSB: Improve get_url in ansible scripts
[yardstick.git] / ansible / roles / download_dpdk / tasks / main.yml
1 # Copyright (c) 2017 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 - debug:
16     var: dpdk_version
17     verbosity: 2
18
19 - file:
20     path: "{{ dpdk_dest }}"
21     state: directory
22
23 - name: fetch dpdk
24   get_url:
25     url: "{{ dpdk_url }}"
26     dest: "{{ dpdk_dest }}"
27     validate_certs: False
28     checksum: "{{ dpdk_md5[dpdk_version] }}"
29   register: package_result
30   until: package_result is succeeded
31   retries: 10
32   delay: 5
33
34 - unarchive:
35     src: "{{ dpdk_dest }}/{{ dpdk_file }}"
36     dest: "{{ dpdk_dest }}/"
37     copy: no
38
39 - name: cleanup tar file to save space
40   file:
41       path: "{{ dpdk_dest }}/{{ dpdk_file }}"
42       state: absent
43
44 - name: find unzipped DPDK folder
45   find:
46     paths: "{{ dpdk_dest }}"
47     patterns: "^dpdk-.*{{ dpdk_version }}$"
48     file_type: directory
49     use_regex: yes
50   register: dpdk_folder_match
51
52 - fail:
53     msg: "Cannot find unzipped DPDK folder or more than one found"
54   when: dpdk_folder_match.matched != 1
55
56 - set_fact:
57     dpdk_path: "{{ dpdk_folder_match.files[0].path }}"
58
59 - set_fact:
60     RTE_SDK: "{{ dpdk_path }}"
61
62 - set_fact:
63     RTE_TARGET: "{{ dpdk_make_arch }}"