diff --git a/playbooks/os-nova-install.yml b/playbooks/os-nova-install.yml index 5c99d99837..ef8d3d5309 100644 --- a/playbooks/os-nova-install.yml +++ b/playbooks/os-nova-install.yml @@ -32,8 +32,14 @@ for i in /dev/nbd*;do lxc-device -n {{ container_name }} add $i $i done + failed_when: false + register: device_add + changed_when: > + 'added' in device_add.stdout.lower() delegate_to: "{{ physical_host }}" - when: is_metal == false or is_metal == "False" + when: > + inventory_hostname in groups['nova_compute'] and + (is_metal == false or is_metal == "False") tags: - nova-kvm - nova-kvm-container-devices @@ -41,7 +47,9 @@ shell: | lxc-device -n {{ container_name }} add /dev/net/tun /dev/net/tun delegate_to: "{{ physical_host }}" - when: is_metal == false or is_metal == "False" + when: > + inventory_hostname in groups['nova_compute'] and + (is_metal == false or is_metal == "False") tags: - nova-kvm - nova-kvm-container-devices @@ -49,7 +57,14 @@ shell: | lxc-device -n {{ container_name }} add /dev/kvm /dev/kvm delegate_to: "{{ physical_host }}" - when: is_metal == false or is_metal == "False" + register: device_add + failed_when: false + changed_when: > + 'added' in device_add.stdout.lower() + when: > + inventory_hostname in groups['nova_compute'] and + (is_metal == false or is_metal == "False") and + nova_virt_type == 'kvm' tags: - nova-kvm - nova-kvm-container-devices diff --git a/playbooks/roles/os_nova/tasks/nova_compute.yml b/playbooks/roles/os_nova/tasks/nova_compute.yml index fd4b343271..4bd7d53c50 100644 --- a/playbooks/roles/os_nova/tasks/nova_compute.yml +++ b/playbooks/roles/os_nova/tasks/nova_compute.yml @@ -14,7 +14,9 @@ # limitations under the License. - include: nova_compute_kvm.yml - when: nova_virt_type == 'kvm' or nova_virt_type == 'qemu' + when: > + nova_virt_type == 'kvm' or + nova_virt_type == 'qemu' - include: nova_compute_key_create.yml