Add virtual image generation to install script
[yardstick.git] / ansible / roles / build_yardstick_image / tasks / post_build.yml
diff --git a/ansible/roles/build_yardstick_image/tasks/post_build.yml b/ansible/roles/build_yardstick_image/tasks/post_build.yml
new file mode 100644 (file)
index 0000000..c6888f8
--- /dev/null
@@ -0,0 +1,46 @@
+# Copyright (c) 2018 Intel Corporation.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+#      http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+---\r
+- name: convert image to image file\r
+  command: qemu-img convert -c -o compat=0.10 -O qcow2 {{ raw_imgfile }} {{ imgfile }}\r
+\r
+# Post build yardstick image\r
+- group_by:\r
+    key: image_builder\r
+\r
+- name: remove ubuntu policy-rc.d workaround\r
+  file:\r
+    path: "{{ mountdir }}/usr/sbin/policy-rc.d"\r
+    state: absent\r
+  when: "target_os == 'Ubuntu'"\r
+\r
+- name: cleanup fake tmp fstab\r
+  file:\r
+    path: "{{ fake_fstab }}"\r
+    state: absent\r
+\r
+- mount:\r
+    name: "{{ mountdir }}/proc"\r
+    state: unmounted\r
+\r
+- mount:\r
+    name: "{{ mountdir }}"\r
+    state: unmounted\r
+\r
+- name: kpartx -dv to delete all image partition device nodes\r
+  command: kpartx -dv "{{ raw_imgfile }}"\r
+  ignore_errors: true\r
+\r
+- debug:\r
+    msg: "yardstick image = {{ imgfile }}"\r