bifrost/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml
Haomeng, Wang 7cf3fa47e4 Support RedHat yum installation
bifrost does not support RedHat rpm installation, in this patch,
added RedHat rpms list, and replace 'apt' Ubuntu command to ansible
pkg_mgr var to support both Ubuntu and RedHat.

And remove the duplication testing packages installation section.

Closes-bug: 1456896
Change-Id: I58d627d3deb4a8a2712f242429e93b8ded9cfb76
2015-06-15 08:29:15 -04:00

57 lines
2.2 KiB
YAML

# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# TODO: Consider converting to ansible virt module.
---
- name: "Install testing apt packages for Ubuntu/Debian"
when: ansible_os_family == 'Debian'
apt: name={{ item }} state=present
with_items:
- libvirt-bin
- qemu-utils
- qemu-kvm
- qemu-system-x86
- sgabios
- name: "Install testing yum packages for RedHat/CentOS/Fedora/OpenSuse"
when: ansible_os_family in ['CentOS', 'Fedora', 'OpenSuse', 'RedHat']
yum: name={{ item }} state=present
with_items:
- libvirt-client
- qemu-img
- qemu-kvm-tools
- qemu-kvm
- qemu-system-x86
- sgabios
- name: "Restart libvirt service"
service: name=libvirt-bin state=restarted
- name: "Create virtual machines"
script: create_vm_nodes-for-role.sh
environment:
NODEOUTPUT: "{{baremetal_csv_file}}"
register: task_create_vm_nodes
ignore_errors: yes
delegate_to: localhost
- name: "Execute `dmesg` to collect debugging output should VM creation fail."
command: dmesg
when: task_create_vm_nodes.rc != 0
- name: "Execute `virsh capabilities` to collect debugging output should VM creation fail."
command: virsh capabilities
when: task_create_vm_nodes.rc != 0
- name: "Abort due to failed VM creation"
fail: msg="VM Creation step failed, please review dmesg output for additional details"
when: task_create_vm_nodes.rc != 0
- name: "Setting file permissions such that the baremetal csv file at /tmp/baremetal.csv can be read by the user executing Ansible"
file: path="{{baremetal_csv_file}}" owner="{{ansible_env.SUDO_USER}}"
when: ansible_env.SUDO_USER is defined and baremetal_csv_file is defined and baremetal_csv_file != ""