Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1258 #1259

Merged
merged 1 commit into from
Apr 19, 2023
Merged

#1258 #1259

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
19 changes: 19 additions & 0 deletions roles/prepare/tasks/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@
- name: 设置系统参数
template: src=95-k8s-sysctl.conf.j2 dest=/etc/sysctl.d/95-k8s-sysctl.conf

- name: 查看是否需要设置 fs.may_detach_mounts
stat:
path: /proc/sys/fs/may_detach_mounts
get_attributes: no
get_checksum: no
get_mime: no
register: fs_may_detach_mounts
ignore_errors: true

- name: 当需要时,设置 fs.may_detach_mounts 为 1
sysctl:
sysctl_file: "/etc/sysctl.d/95-k8s-sysctl.conf"
name: fs.may_detach_mounts
value: 1
state: present
reload: yes
when: fs_may_detach_mounts.stat.exists|bool


- name: 生效系统参数
shell: "source /etc/profile; sysctl -p /etc/sysctl.d/95-k8s-sysctl.conf"
ignore_errors: true
Expand Down