Add VM creation support on Debian jessie

Debian jessie changed the libvirt service name from the prior
release and as such we need additional logic to load the defaults
and a defaults file that represents jessie.

Additionally, we need to ensure that we start the default network
as it may not be started by default on Debian jessie.

Change-Id: I48a64f61d8ba42f76c2df3b984d3090b68e3cf93
Partial-Bug: 1522552
This commit is contained in:
Julia Kreger 2015-12-03 14:50:13 -05:00
parent 5dec04a8d0
commit 453eb8a021
3 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,2 @@
---
# Note(TheJulia): This file is intentionally left empty. Do not edit.

View File

@ -0,0 +1,2 @@
---
libvirt_service_name: libvirtd

View File

@ -23,6 +23,11 @@
with_first_found:
- "../defaults/required_defaults_{{ ansible_distribution }}.yml"
- "../defaults/required_defaults_{{ ansible_os_family }}.yml"
- name: "Include OS version-specific defaults"
include_vars: "{{ item }}"
with_first_found:
- "../defaults/required_defaults_{{ ansible_distribution }}_{{ ansible_distribution_release }}.yml"
- "../defaults/dummy-defaults.yml"
# NOTE(cinerama): On Fedora 22, ansible 1.9, ansible_pkg_mgr
# defaults to yum, which may not be installed. This can be safely
# removed when we start using an ansible release which prefers dnf.
@ -39,6 +44,13 @@
with_items: required_packages
- name: "Restart libvirt service"
service: name="{{libvirt_service_name}}" state=restarted
- name: "Verify default network is running"
shell: virsh net-info default |grep Active|grep -q yes
register: virsh_network_status
ignore_errors: yes
- name: "Start default network if not running"
command: virsh net-start default
when: virsh_network_status.rc != 0
- name: "Create virtual machines"
script: create_vm_nodes-for-role.sh
environment: