+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/hugepages_grub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- "added option to disable transparent hugepages in grub (oravirt#460)"
3 changes: 3 additions & 0 deletions roles/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ common_packages_el7:
- btrfs-progs
- procps
- psmisc
- grubby
```

### common_packages_el8
Expand Down Expand Up @@ -203,6 +204,7 @@ common_packages_el8:
- psmisc
- python3
- python3-pip
- grubby
```

### common_packages_el9
Expand Down Expand Up @@ -256,6 +258,7 @@ common_packages_el9:
- util-linux-ng
- xorg-x11-utils
- xorg-x11-xauth
- grubby
```

### common_packages_sles
Expand Down
3 changes: 3 additions & 0 deletions roles/common/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ common_packages_el7:
- btrfs-progs
- procps
- psmisc
- grubby

# @var common_packages_el8:description: >
# List of RPMs for RHEL8 or OL8
Expand Down Expand Up @@ -191,6 +192,7 @@ common_packages_el8:
- psmisc
- python3
- python3-pip
- grubby

# @var common_packages_el8:description: >
# List of RPMs for RHEL8 or OL8
Expand Down Expand Up @@ -240,6 +242,7 @@ common_packages_el9:
- util-linux-ng
- xorg-x11-utils
- xorg-x11-xauth
- grubby

# @var common_packages_sles:description: >
# List of RPMs for SuSE Linux Enterprise Server
Expand Down
14 changes: 14 additions & 0 deletions roles/orahost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Role to configure the hostsystem for ansible-oracle
- [ssh_keys](#ssh_keys)
- [sudoers_template](#sudoers_template)
- [transparent_hugepage_disable](#transparent_hugepage_disable)
- [transparent_hugepage_disable_by_grub](#transparent_hugepage_disable_by_grub)
- [Discovered Tags](#discovered-tags)
- [Open Tasks](#open-tasks)
- [Dependencies](#dependencies)
Expand Down Expand Up @@ -812,6 +813,19 @@ transparent_hugepage_disable:
- {disable: echo never >, path: /sys/kernel/mm/transparent_hugepage/defrag, rclocal: /etc/rc.d/rc.local}
```

### transparent_hugepage_disable_by_grub

Alternatively to dynamically disabling transparent hugepages using rc.local,
disable transparent hugepages using kernel command line.

_Note_: Setting transparent_hugepage_disable_by_grub true obsoletes transparent_hugepage_disable

#### Default value

```YAML
transparent_hugepage_disable_by_grub: false
```

## Discovered Tags

**_always_**
Expand Down
9 changes: 9 additions & 0 deletions roles/orahost/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@ transparent_hugepage_disable:
- {disable: "echo never >", path: /sys/kernel/mm/transparent_hugepage/enabled, rclocal: /etc/rc.d/rc.local}
- {disable: "echo never >", path: /sys/kernel/mm/transparent_hugepage/defrag, rclocal: /etc/rc.d/rc.local}

# @var transparent_hugepage_disable_by_grub:description: >
# Alternatively to dynamically disabling transparent hugepages using rc.local,
# disable transparent hugepages using kernel command line.
#
# _Note_: Setting transparent_hugepage_disable_by_grub true obsoletes transparent_hugepage_disable
#
# @end
transparent_hugepage_disable_by_grub: false

# @var host_fs_layout:description: >
# Define physical Disk, Volume Group, logical Volume, Filesystem and swap Devices.
# See example configuration
Expand Down
64 changes: 43 additions & 21 deletions roles/orahost/tasks/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,48 @@
when:
- ansible_distribution_major_version is version('7', '>=')
block:
- name: Disable Transparent Hugepages (runtime)
ansible.builtin.shell: if test -f {{ item.path }}; then {{ item.disable }} {{ item.path }}; fi;
# noqa no-changed-when
with_items:
- "{{ transparent_hugepage_disable }}"
tags: tphnuma,molecule-idempotence-notest
- name: Disable Transparent Hugepages by script
when: not transparent_hugepage_disable_by_grub
block:
- name: Disable Transparent Hugepages (runtime)
ansible.builtin.shell: if test -f {{ item.path }}; then {{ item.disable }} {{ item.path }}; fi;
# noqa no-changed-when
with_items:
- "{{ transparent_hugepage_disable }}"
tags: tphnuma,molecule-idempotence-notest

- name: Disable Transparent Hugepages (permanently)
ansible.builtin.lineinfile:
dest: "{{ item.rclocal }}"
line: "{{ item.disable }} {{ item.path }}"
state: present
with_items:
- "{{ transparent_hugepage_disable }}"
tags: tphnuma,molecule-idempotence-notest
- name: Disable Transparent Hugepages (permanently)
ansible.builtin.lineinfile:
dest: "{{ item.rclocal }}"
line: "{{ item.disable }} {{ item.path }}"
state: present
with_items:
- "{{ transparent_hugepage_disable }}"
tags: tphnuma,molecule-idempotence-notest

- name: Fix permissions on /etc/rc.d/rc.local
ansible.builtin.file:
path: "{{ item.rclocal }}"
mode: "0755"
with_items:
- "{{ transparent_hugepage_disable }}"
tags: tphnuma
- name: Fix permissions on /etc/rc.d/rc.local
ansible.builtin.file:
path: "{{ item.rclocal }}"
mode: "0755"
with_items:
- "{{ transparent_hugepage_disable }}"
tags: tphnuma

- name: Disable Transparent Hugepages by grub cmdline
when: transparent_hugepage_disable_by_grub
block:
- name: Check if transparent_hugepage=never already present in kernel cmdline
ansible.builtin.lineinfile:
path: /proc/cmdline
regexp: '.*\btransparent_hugepage\s*=\s*never\b'
state: absent
check_mode: true
changed_when: false
register: __orahost_transhp_in_cmdline

- name: Set transparent_hugepage=never in kernel cmdline
ansible.builtin.command: grubby --update-kernel=ALL --args=transparent_hugepage=never
changed_when: true
when: __orahost_transhp_in_cmdline.found == 0
notify:
- restart server
39 changes: 39 additions & 0 deletions roles/orahost/tasks/Suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,52 @@
notify: Reboot concerning package updates

- name: Disable Transparent Hugepages (runtime)
when: not transparent_hugepage_disable_by_grub
ansible.builtin.shell: |
[ -f /sys/kernel/mm/transparent_hugepage/enabled ] && echo never > /sys/kernel/mm/transparent_hugepage/enabled && echo changed
[ -f /sys/kernel/mm/transparent_hugepage/defrag ] && echo never > /sys/kernel/mm/transparent_hugepage/defrag && echo changed
register: tphnuma_result
changed_when: "'changed' in tphnuma_result.stdout"
tags: tphnuma

- name: Disable Transparent Hugepages by grub cmdline
when: transparent_hugepage_disable_by_grub
block:

- name: Check if transparent_hugepage=never already present in kernel cmdline
ansible.builtin.lineinfile:
path: /proc/cmdline
regexp: '.*\btransparent_hugepage\s*=\s*never\b'
state: absent
check_mode: true
changed_when: false
register: __orahost_transhp_in_cmdline

- name: Force transparent_hugepage=never in cmdline defaults
ansible.builtin.lineinfile:
path: /etc/default/grub
regexp: '(^\s*GRUB_CMDLINE_LINUX\s*=.*\btransparent_hugepage\s*=\s*)(\b\S+\b)(.*)'
backrefs: true
line: '\1never\3'
when: __orahost_transhp_in_cmdline.found > 0
register: __orahost_transhp_disabled

- name: Append transparent_hugepage=never to cmdline defaults
ansible.builtin.lineinfile:
path: /etc/default/grub
regexp: '(^\s*GRUB_CMDLINE_LINUX\s*=.*)(")'
backrefs: true
line: '\1 transparent_hugepage=never\2'
when: __orahost_transhp_in_cmdline.found == 0
register: __orahost_transhp_appended

- name: Write new grub2 config file
ansible.builtin.command: grub2-mkconfig -o /boot/grub2/grub.cfg
when: ( __orahost_transhp_disabled.changed | default(false) ) or ( __orahost_transhp_appended.changed | default(false) )
changed_when: true
notify:
- restart server

- name: Oracle-recommended security limits on SLES # noqa args[module]
community.general.pam_limits:
domain: oracle
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载