Fix ansible-lint warnings

Change-Id: I4980b5577984f673eec23ce9a07fccf26fbcd875
diff --git a/playbooks/create-libvirt-resources.yml b/playbooks/create-libvirt-resources.yml
index 3d67ab3..73638ad 100644
--- a/playbooks/create-libvirt-resources.yml
+++ b/playbooks/create-libvirt-resources.yml
@@ -36,6 +36,7 @@
     - name: Get libvirt networks
       command: virsh net-list --all
       register: libvirt_networks
+      changed_when: false
 
     - name: List libvirt networks
       debug:
@@ -44,6 +45,7 @@
     - name: Get libvirt vms
       command: virsh list --all
       register: libvirt_vms
+      changed_when: false
 
     - name: List libvirt vms
       debug:
@@ -51,9 +53,10 @@
 
     - name: Get list of nodes from vbmc
       command: vbmc list
+      register: vbmc_vms
+      changed_when: false
       environment:
         PATH: "{{ engine_venv }}/bin"
-      register: vbmc_vms
 
     - name: List vbmc nodes
       debug:
diff --git a/playbooks/main.yml b/playbooks/main.yml
index fa12357..7c144bb 100644
--- a/playbooks/main.yml
+++ b/playbooks/main.yml
@@ -19,7 +19,7 @@
 
 - name: Create libvirt resources
   import_playbook: create-libvirt-resources.yml
-  when: baremetal|bool == false
+  when: not baremetal|bool
 
 - name: Install and configure bifrost
   import_playbook: install-configure-bifrost.yml
diff --git a/playbooks/roles/create-libvirt-vms/tasks/create-libvirt-vms.yml b/playbooks/roles/create-libvirt-vms/tasks/create-libvirt-vms.yml
index 70e131e..a2f0eda 100644
--- a/playbooks/roles/create-libvirt-vms/tasks/create-libvirt-vms.yml
+++ b/playbooks/roles/create-libvirt-vms/tasks/create-libvirt-vms.yml
@@ -91,12 +91,16 @@
     virtual_ipmi_port: "{{ ( node.remote_management.port | default(623) | int ) }}"
 
 - name: Plug vm '{{ hostname }}' into vbmc on port '{{ virtual_ipmi_port }}'
-  command: "vbmc add {{ hostname }} --libvirt-uri {{ vm_libvirt_uri }} --port {{ virtual_ipmi_port }}"
+  command: "vbmc add {{ hostname }} --libvirt-uri {{ vm_libvirt_uri }} --port {{ virtual_ipmi_port }} --verbose"
+  register: vbmc_add
+  args:
+    creates: "{{ ansible_env.HOME }}/.vbmc/{{ hostname }}"
   environment:
     PATH: "{{ engine_venv }}/bin"
 
 - name: Start vbmc for '{{ hostname }}'
-  command: "vbmc start {{ hostname }}"
+  command: "vbmc start {{ hostname }} --verbose"
+  when: not vbmc_add.stdout
   environment:
     PATH: "{{ engine_venv }}/bin"
 
diff --git a/playbooks/roles/create-libvirt-vms/tasks/create-libvirt-volumes.yml b/playbooks/roles/create-libvirt-vms/tasks/create-libvirt-volumes.yml
index a5de66b..75e9fbc 100644
--- a/playbooks/roles/create-libvirt-vms/tasks/create-libvirt-volumes.yml
+++ b/playbooks/roles/create-libvirt-vms/tasks/create-libvirt-volumes.yml
@@ -23,16 +23,20 @@
     vm_vol_path_prefix: "{{ ansible_libvirt_pools[libvirt_storage_pool].path }}/{{ hostname }}"
 
 - name: Delete volume '{{ vm_volume_name }}' for vm '{{ hostname }}'
-  command: >
+  command: |
     virsh --connect {{ vm_libvirt_uri }}
     vol-delete --pool {{ libvirt_storage_pool }} {{ vm_volume_name }}
+  args:
+    removes: "{{ vm_vol_path_prefix }}-{{ disk.name }}.qcow2"
   ignore_errors: yes
 
 - name: Create volume '{{ vm_volume_name }}' for vm '{{ hostname }}'
-  command: >
+  command: |
     virsh --connect {{ vm_libvirt_uri }}
-      vol-create-as {{ libvirt_storage_pool }} {{ vm_volume_name }}
+    vol-create-as {{ libvirt_storage_pool }} {{ vm_volume_name }}
       {{ disk.disk_capacity }} --format qcow2 {{ prealloc|default("") }}
+  args:
+    creates: "{{ vm_vol_path_prefix }}-{{ disk.name }}.qcow2"
 
 - name: Pre-touch volume '{{ vm_volume_name }}' for vm '{{ hostname }}'
   file:
diff --git a/playbooks/roles/create-libvirt-vms/tasks/main.yml b/playbooks/roles/create-libvirt-vms/tasks/main.yml
index 0defb0c..6205742 100644
--- a/playbooks/roles/create-libvirt-vms/tasks/main.yml
+++ b/playbooks/roles/create-libvirt-vms/tasks/main.yml
@@ -26,6 +26,8 @@
 
 - name: Stop existing virtualbmc processes
   command: killall -w vbmc
+  args:
+    removes: "{{ ansible_env.HOME }}/.vbmc/master.pid"
   ignore_errors: yes
 
 - name: Remove outdated virtualbmc folder
diff --git a/playbooks/roles/get-baremetal-info/tasks/main.yml b/playbooks/roles/get-baremetal-info/tasks/main.yml
index 9fa6b0f..aca6313 100644
--- a/playbooks/roles/get-baremetal-info/tasks/main.yml
+++ b/playbooks/roles/get-baremetal-info/tasks/main.yml
@@ -29,20 +29,28 @@
 
 - name: Fetch mgmt network interface name
   set_fact:
-    mgmt_ifname: "{{ (node.interfaces[idf.net_config.mgmt.interface].vlan == 'native') | ternary(interface.device, interface.device + '.' + node.interfaces[idf.net_config.mgmt.interface].vlan) }}"
-  loop: "{{ ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') | map('extract', hostvars[inventory_hostname]) |  selectattr('macaddress','defined') | list }}"
+    mgmt_ifname: |-
+      {{ (node.interfaces[idf.net_config.mgmt.interface].vlan == 'native') |
+      ternary(interface.device, interface.device + '.' + node.interfaces[idf.net_config.mgmt.interface].vlan) }}
+  loop: |-
+      {{ ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') |
+      map('extract', hostvars[inventory_hostname]) |  selectattr('macaddress','defined') | list }}
   loop_control:
     loop_var: interface
   when:
     - interface.macaddress == node.interfaces[idf.net_config.mgmt.interface].mac_address
-    - "{{ '.' not in interface.device }}"
+    - "'.' not in interface.device"
 
 - name: Fetch neutron network interface name
   set_fact:
-    neutron_ifname: "{{ (node.interfaces[idf.net_config.neutron.interface].vlan == 'native') | ternary(interface.device, interface.device + '.' + node.interfaces[idf.net_config.neutron.interface].vlan) }}"
-  loop: "{{ ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') | map('extract', hostvars[inventory_hostname]) |  selectattr('macaddress','defined') | list }}"
+    neutron_ifname: |-
+      {{ (node.interfaces[idf.net_config.neutron.interface].vlan == 'native') |
+      ternary(interface.device, interface.device + '.' + node.interfaces[idf.net_config.neutron.interface].vlan) }}
+  loop: |-
+      {{ ansible_interfaces | map('regex_replace', '-', '_') | map('regex_replace', '^', 'ansible_') |
+      map('extract', hostvars[inventory_hostname]) |  selectattr('macaddress','defined') | list }}
   loop_control:
     loop_var: interface
   when:
     - interface.macaddress == node.interfaces[idf.net_config.neutron.interface].mac_address
-    - "{{ '.' not in interface.device }}"
+    - "'.' not in interface.device"
diff --git a/playbooks/roles/install-configure-bifrost/tasks/cleanup-bifrost.yml b/playbooks/roles/install-configure-bifrost/tasks/cleanup-bifrost.yml
index 1270e86..4a51eb8 100644
--- a/playbooks/roles/install-configure-bifrost/tasks/cleanup-bifrost.yml
+++ b/playbooks/roles/install-configure-bifrost/tasks/cleanup-bifrost.yml
@@ -20,6 +20,7 @@
   command: killall -w dnsmasq
   ignore_errors: yes
   become: yes
+  changed_when: false
 
 - name: Remove existing files and directories
   file:
diff --git a/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-file.yml b/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-file.yml
index d16a050..95d8016 100644
--- a/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-file.yml
+++ b/playbooks/roles/install-configure-bifrost/tasks/create-bifrost-inventory-file.yml
@@ -31,7 +31,6 @@
   file:
     path: "{{ bifrost_inventory_source }}"
     owner: "{{ ansible_env.SUDO_USER }}"
-  when: >
-    ansible_env.SUDO_USER is defined
+  when: ansible_env.SUDO_USER is defined
 
 # vim: set ts=2 sw=2 expandtab:
diff --git a/playbooks/roles/install-configure-bifrost/tasks/download-image.yml b/playbooks/roles/install-configure-bifrost/tasks/download-image.yml
index 0c1a932..c42f4e2 100644
--- a/playbooks/roles/install-configure-bifrost/tasks/download-image.yml
+++ b/playbooks/roles/install-configure-bifrost/tasks/download-image.yml
@@ -16,7 +16,8 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
-- set_fact:
+- name: Set download source and destination for the deployment image
+  set_fact:
     source: "{{ item.source }}"
     destination: "{{ item.destination }}"
     download_image: "{{ item.download }}"
diff --git a/playbooks/roles/prepare-libvirt/tasks/main.yml b/playbooks/roles/prepare-libvirt/tasks/main.yml
index 203675d..593613b 100644
--- a/playbooks/roles/prepare-libvirt/tasks/main.yml
+++ b/playbooks/roles/prepare-libvirt/tasks/main.yml
@@ -61,9 +61,9 @@
 
 - name: "Place sgabios.bin"
   command: cp /usr/share/misc/sgabios.bin /usr/share/qemu/sgabios.bin
-  when: >
-    test_sgabios_qemu == false and
-    test_sgabios_misc == true
+  when:
+    - not test_sgabios_qemu
+    - test_sgabios_misc
 
 # NOTE(TheJulia): In order to prevent conflicts, stop
 # dnsmasq to prevent conflicts with libvirt restarting.