This repository has been archived on 2026-11-16. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
openstack-deployment/ansible/playbooks/change_cpu_affinity.conf
T
2020-08-12 00:02:27 +03:00

93 lines
2.4 KiB
Plaintext

---
- hosts: bonchvisors
remote_user: cephadmin
become: true
become_user: root
become_method: sudo
tasks:
- name: check ceph-mon service exist
shell: systemctl list-units --type=service --all | grep ceph-mon | awk '{print $1}'
args:
executable: /bin/bash
register: mon_service
# определение OSD
- name: find OSD and check if exist
shell: systemctl list-units --type=service --all | grep ceph-osd | awk '{print $1}'
args:
executable: /bin/bash
register: osd_service
- name: check ceph-mon service exist
shell: systemctl list-units --type=service --all | grep ceph-mon | awk '{print $1}'
args:
executable: /bin/bash
register: mon_service
# определение OSD
- name: find OSD and check if exist
shell: systemctl list-units --type=service --all | grep ceph-osd | awk '{print $1}'
args:
executable: /bin/bash
register: osd_service
# определение MGR
- name: check ceph-mgr service exist
shell: systemctl list-units --type=service --all | grep ceph-mgr | awk '{print $1}'
args:
executable: /bin/bash
register: mgr_service
- name: Change ceph-osd cpu affinity
lineinfile:
path: /usr/lib/systemd/system/ceph-osd@.service
insertbefore: '^RestartSec=*'
line: CPUAffinity=0,1
when: osd_service.stdout != ""
- name: Change ceph-mon cpu affinity
lineinfile:
path: /usr/lib/systemd/system/ceph-mon@.service
insertbefore: '^RestartSec=*'
line: CPUAffinity=0,1
when: mon_service.stdout != ""
- name: Change ceph-mgr cpu affinity
lineinfile:
path: /usr/lib/systemd/system/ceph-mgr@.service
insertbefore: '^StartLimitBurst=*'
line: CPUAffinity=0,1
when: mgr_service.stdout != ""
- name: restart ceph-osd service
systemd:
state: restarted
daemon_reload: yes
name: "{{ item }}"
loop: "{{osd_service.stdout_lines}}"
when: osd_service.stdout != ""
- name: restart ceph-mon service
systemd:
state: restarted
daemon_reload: yes
name: "{{ item }}"
loop: "{{mon_service.stdout_lines}}"
when: mon_service.stdout != ""
- name: restart ceph-mgr service
systemd:
state: restarted
daemon_reload: yes
name: "{{ item }}"
loop: "{{mgr_service.stdout_lines}}"
when: mgr_service.stdout != ""