Update grub in enable_iommu_on_boot when needed 25/67125/1
authorStepan Andrushko <stepanx.andrushko@intel.com>
Wed, 27 Feb 2019 11:40:13 +0000 (13:40 +0200)
committerStepan Andrushko <stepanx.andrushko@intel.com>
Wed, 27 Feb 2019 11:40:13 +0000 (13:40 +0200)
Improve conditions when to update grub in enable_iommu_on_boot
ansible role.

JIRA: YARDSTICK-1603

Change-Id: Ic16b84beb55e45e4b75c120761397dc3207ef6f4
Signed-off-by: Stepan Andrushko <stepanx.andrushko@intel.com>
ansible/roles/enable_iommu_on_boot/tasks/main.yml

index 188b329..2772a5d 100644 (file)
       - not is_nsb_iommu_role.changed
       - is_iommu.changed
 
-  - name: Add IOMMU when it is not set
-    lineinfile:
-      path: "{{ grub_file }}"
-      regexp: "{{ iommu_help_string }}"
-      line: '{{ enable_iommu }}" {{ iommu_help_string }}'
+  - block:
+    - name: Add IOMMU when it is not set
+      lineinfile:
+        path: "{{ grub_file }}"
+        regexp: "{{ iommu_help_string }}"
+        line: '{{ enable_iommu }}" {{ iommu_help_string }}'
+
+    - name: find boot grub.cfg
+      find:
+        paths: /boot
+        file_type: file
+        patterns: 'grub*.cfg'
+        recurse: yes
+      register: grub_files
+
+    - include: manual_modify_grub.yml
+      # only tested on Ubuntu, kernel line is probably different on other distros
+      with_items: "{{ grub_files.files }}"
     when:
+      - ansible_distribution == "Ubuntu"
       - not is_nsb_iommu_role.changed
       - not is_iommu.changed
-
-  - name: find boot grub.cfg
-    find:
-      paths: /boot
-      file_type: file
-      patterns: 'grub*.cfg'
-      recurse: yes
-    register: grub_files
-
-  - include: manual_modify_grub.yml
-    # only tested on Ubuntu, kernel line is probably different on other distros
-    with_items: "{{ grub_files.files }}"
-    when: ansible_distribution == "Ubuntu"
   when: iommu_boot_params is defined