summaryrefslogtreecommitdiffstats
path: root/plugins/dpdk/roles/ins_dpdk/tasks/hugepages.yml
blob: d68fc03123ac85eca26c29972715e35dee778289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# #############################################################################
# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# #############################################################################
---
# yamllint disable rule:truthy
- name: Check hugepages
  shell: grep -q intel_iommu /etc/default/grub
  register: check_result
  ignore_errors: True
# yamllint enable rule:truthy

- name: Config grub
  lineinfile:
    dest: /etc/default/grub
    regexp: '^GRUB_CMDLINE_LINUX_DEFAULT=""'
    line: "{{ grub_cmdline }}"
    state: present
  when: check_result.rc == 1

- name: Update grub
  shell: update-grub
  when: check_result.rc == 1

- name: wait a moment
  command: sleep 5
  when: check_result.rc == 1

- name: Reboot
  shell: sleep 2 && shutdown -r now 'Reboot required'
  become: true
  async: 1
  poll: 0
  when: check_result.rc == 1
  ignore_errors: true

- name: Wait for reboot
  local_action:
    module: wait_for
      host={{ ansible_eth0.ipv4.address }} port=22 delay=10 timeout=1200
  when: check_result.rc == 1