Merge "Fix Prox L2fwd generator packet"
[yardstick.git] / ansible / roles / create_dockerfile / 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 - set_fact:
16     yardstick_image_name: "yardstick_python{{ python_version }}_{{ target_os }}"
17   tags:
18     - create_template
19
20 - debug: var=docker_build_dir
21
22 - file: dest="{{ docker_build_dir }}" state=directory
23   tags:
24     - create_template
25
26 - template: "src={{ target_os }}/Dockerfile dest={{ docker_build_dir }}/Dockerfile"
27   tags:
28     - create_template
29
30 - name: bootstrap repos
31   template: "src=Ubuntu-repos.j2 dest={{ docker_build_dir}}/sources.list"
32   when: use_ext == "intr"
33
34 - name: Create apt.conf.d/ proxy config
35   template:
36     src: apt_conf.j2
37     dest: "{{ docker_build_dir }}/20proxy"
38   when: "'http_proxy' in proxy_env"
39
40 - name: set pip mirror
41   template: "src=pip.conf.j2 dest={{ docker_build_dir }}/pip.conf"
42   when: pip_mirror_url is defined and pip_mirror_url
43
44 - name: easy_utils mirror
45   template: "src=pydistutils.cfg.j2 dest={{ docker_build_dir }}/pydistutils.cfg"
46   when: pip_mirror_url is defined and pip_mirror_url
47
48 - set_fact:
49     yardstick_base: "{{ docker_registry ~ '/' if docker_registry|default('') else '' }}{{ yardstick_image_name}}"
50
51
52 - set_fact:
53     yardstick_base_tag: "{{ docker_image_tag|default('v1') }}"
54
55 - debug: var=yardstick_base
56
57 #- command: "docker build {{ docker_build_dir }}"
58 #- fail: msg="don't build"
59
60 - docker_image:
61     name: "{{ yardstick_base }}"
62     tag: "{{ yardstick_base_tag }}"
63     path: "{{ docker_build_dir }}"
64     state: present
65     force: yes
66     rm: true
67     # push is broken, manually push
68     push: no
69   ignore_errors: yes
70   register: docker_image_results
71   when: not release
72 - debug: var=docker_image_results
73
74 - name: manual push image
75   command: docker push {{ yardstick_base }}
76   when: not release and docker_image_results|changed
77   register: docker_image_push
78   tags:
79     - push_image
80
81 - debug: var=docker_image_push
82