This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tsg-tsg-os-buildimage/ansible/roles/system-init-9140/tasks/main.yml
songyanchao 72fd71d4d0 feat(TSG-OS-9140): CPU FrequencyScaling
通过使能cpupower来设置CPU frequency scaling来优化9140性能
2021-11-18 10:56:45 +00:00

270 lines
7.6 KiB
YAML

---
- name: "set 90-9000NPBP01R01.rules"
template:
src: "{{ role_path }}/templates/90-9000NPBP01R01.rules.j2"
dest: /usr/lib/udev/rules.d/90-9000NPBP01R01.rules
mode: 0644
tags: template
- name: "set eth_pf_smbio cfg"
template:
src: "{{ role_path }}/templates/ifcfg-eth_pf_smbio.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_pf_smbio
tags: template
- name: "set eth_vf_raw cfg"
template:
src: "{{ role_path }}/templates/ifcfg-eth_vf_raw.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_vf_raw
tags: template
- name: "set eth_vf_dign_c cfg"
template:
src: "{{ role_path }}/templates/ifcfg-eth_vf_dign_c.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_vf_dign_c
tags: template
- name: "set eth_vf_dign_s cfg"
template:
src: "{{ role_path }}/templates/ifcfg-eth_vf_dign_s.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_vf_dign_s
tags: template
- name: "set set-eth_vf_raw-macaddr.sh"
template:
src: "{{ role_path }}/templates/set-eth_vf_raw-macaddr.sh.toml.j2"
dest: /usr/bin/set-eth_vf_raw-macaddr.sh
mode: 0777
tags: template
- name: "set eth_pf_smbcx cfg "
template:
src: "{{ role_path }}/templates/ifcfg-eth_pf_smbcx.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_pf_smbcx
tags: template
- name: "set eth_vf_kni cfg"
template:
src: "{{ role_path }}/templates/ifcfg-eth_vf_kni.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_vf_kni
tags: template
- name: "set eth_vf_tfe cfg"
template:
src: "{{ role_path }}/templates/ifcfg-eth_vf_tfe.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_vf_tfe
tags: template
- name: "set eth_vf_mirr cfg"
template:
src: "{{ role_path }}/templates/ifcfg-eth_vf_mirr.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_vf_mirr
tags: template
- name: "set eth_vf_ctl cfg"
template:
src: "{{ role_path }}/templates/ifcfg-eth_vf_ctl.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_vf_ctl
tags: template
- name: "set if-pre-up "
template:
src: "{{ role_path }}/templates/if-pre-up.toml.j2"
dest: /etc/NetworkManager/dispatcher.d/pre-up.d/if-pre-up
mode: 0755
tags: template
- name: "copy eth_pf_mgmt0.ips cfg"
template:
src: "{{ role_path }}/templates/setup.eth_pf_mgmt0.ips.toml.j2"
dest: /sbin/setup.eth_pf_mgmt0.ips
mode: 0777
tags: template
- name: "copy eth_pf_mgmt1.ips cfg"
template:
src: "{{ role_path }}/templates/setup.eth_pf_mgmt1.ips.toml.j2"
dest: /sbin/setup.eth_pf_mgmt1.ips
mode: 0777
tags: template
- name: "copy setup.eth_vf_tfe.ips"
template:
src: "{{ role_path }}/templates/setup.eth_vf_tfe.ips.toml.j2"
dest: /sbin/setup.eth_vf_tfe.ips
mode: 0777
tags: template
- name: "set eth_pf_xe0 cfg "
template:
src: "{{ role_path }}/templates/ifcfg-eth_pf_xe0.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_pf_xe0
tags: template
- name: "set eth_pf_xe1 cfg "
template:
src: "{{ role_path }}/templates/ifcfg-eth_pf_xe1.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_pf_xe1
tags: template
- name: "set eth_pf_mgmt0 cfg "
template:
src: "{{ role_path }}/templates/ifcfg-eth_pf_mgmt0.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_pf_mgmt0
tags: template
- name: "set eth_pf_mgmt1 cfg "
template:
src: "{{ role_path }}/templates/ifcfg-eth_pf_mgmt1.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_pf_mgmt1
tags: template
- name: "set eth_pf_ge0 cfg "
template:
src: "{{ role_path }}/templates/ifcfg-eth_pf_ge0.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_pf_ge0
tags: template
- name: "set eth_pf_ge1 up "
template:
src: "{{ role_path }}/templates/ifcfg-eth_pf_ge1.toml.j2"
dest: /etc/sysconfig/network-scripts/ifcfg-eth_pf_ge1
tags: template
# systemctl set-property user.slice CPUShares=1500 MemoryLimit=13G
# systemctl set-property system.slice CPUShares=1000 MemoryLimit=13G
# systemctl set-property workload.slice CPUShares=7500 MemoryLimit=100G
# workload.slice
- name: "Create /usr/lib/systemd/system/workload.slice.d/ directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/workload.slice.d/
- name: "copy 50-CPUShares.conf to workload.slice.d"
copy:
src: "{{ role_path }}/templates/override_workload_slice_cpu.conf.j2"
dest: /usr/lib/systemd/system/workload.slice.d/50-CPUShares.conf
mode: 0644
- name: "copy 50-MemoryLimit.conf to workload.slice.d"
copy:
src: "{{ role_path }}/templates/override_workload_slice_mem.conf.j2"
dest: /usr/lib/systemd/system/workload.slice.d/50-MemoryLimit.conf
mode: 0644
# user.slice
- name: "Create /usr/lib/systemd/system/user.slice.d/ directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/user.slice.d/
- name: "copy 50-CPUShares.conf to user.slice.d"
copy:
src: "{{ role_path }}/templates/override_user_slice_cpu.conf.j2"
dest: /usr/lib/systemd/system/user.slice.d/50-CPUShares.conf
mode: 0644
- name: "copy 50-MemoryLimit.conf to user.slice.d"
copy:
src: "{{ role_path }}/templates/override_user_slice_mem.conf.j2"
dest: /usr/lib/systemd/system/user.slice.d/50-MemoryLimit.conf
mode: 0644
# system.slice
- name: "Create /usr/lib/systemd/system/system.slice.d/ directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/system.slice.d/
- name: "copy 50-CPUShares.conf to system.slice.d"
copy:
src: "{{ role_path }}/templates/override_system_slice_cpu.conf.j2"
dest: /usr/lib/systemd/system/system.slice.d/50-CPUShares.conf
mode: 0644
- name: "copy 50-MemoryLimit.conf to system.slice.d"
copy:
src: "{{ role_path }}/templates/override_system_slice_mem.conf.j2"
dest: /usr/lib/systemd/system/system.slice.d/50-MemoryLimit.conf
mode: 0644
# 启用 IPMI
- name: "copy ipmi.conf to /etc/sysconfig/ipmi"
copy:
src: "{{ role_path }}/templates/ipmi.conf.j2"
dest: /etc/sysconfig/ipmi
mode: 0644
- name: "enable ipmi"
systemd:
name: ipmi
enabled: yes
# 启用 Watchdog
- name: "copy watchdog.conf to /etc/watchdog.conf"
copy:
src: "{{ role_path }}/templates/watchdog.conf.j2"
dest: /etc/watchdog.conf
mode: 0644
- name: "enable watchdog"
systemd:
name: watchdog
enabled: yes
- name: "enable irqbalance"
systemd:
name: irqbalance
enabled: yes
# 关闭DHCPDISCOVER
- name: "set 90-9000-dracut.rules"
template:
src: "{{ role_path }}/templates/90-9000-dracut.rules.j2"
dest: /usr/lib/dracut/dracut.conf.d/90-9000-dracut.conf
mode: 0644
tags: template
# poweroff guard
- name: "templates poweroff-guard.service.j2"
template:
src: "{{role_path}}/templates/poweroff-guard.service.j2"
dest: /usr/lib/systemd/system/poweroff-guard.service
tags: template
- name: "templates start-poweroff-guard.service.j2"
template:
src: "{{role_path}}/templates/start-poweroff-guard.service.j2"
dest: /usr/lib/systemd/system/start-poweroff-guard.service
tags: template
- name: 'poweroff-guard service start'
systemd:
name: poweroff-guard
enabled: yes
- name: 'start-poweroff-guard service start'
systemd:
name: start-poweroff-guard
enabled: yes
#Set CPU frequency scaling
- name: "copy cpupower.j2 to /etc/sysconfig/cpupower"
copy:
src: "{{ role_path }}/templates/cpupower.j2"
dest: /etc/sysconfig/cpupower
mode: 0644
- name: "enable cpupower"
systemd:
name: cpupower
enabled: yes