# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. --- - name: Set up 1G hugepages become: true block: - name: Configure grub lineinfile: dest: "{{ grub_default_config }}" line: 'GRUB_CMDLINE_LINUX="default_hugepagesz={{ hugepages.size }} hugepagesz={{ hugepages.size }} hugepages={{ hugepages.number }}"' regexp: '^GRUB_CMDLINE_LINUX="' - name: Update grub configuration command: update-grub2 - name: Reboot host reboot: reboot_timeout: 600 when: hugepages.size == "1G" - name: Set up 2M hugepages become: true sysctl: name: vm.nr_hugepages value: "{{ hugepages.number }}" sysctl_set: true reload: true when: hugepages.size == "2M" ...