-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathfree_file_system.yml
More file actions
42 lines (42 loc) · 1.26 KB
/
free_file_system.yml
File metadata and controls
42 lines (42 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
- name: restart server
gather_facts: false
hosts: localhost
vars:
device: "{{ansible_eda.event.payload.host}}"
tasks:
- name: List of openfile in directory
ansible.builtin.shell: lsof /dev/shm
delegate_to: "{{device}}"
register: lsof
- name: List open files in /dev/shm
debug:
msg: '{{top_cpu.stdout_lines}}'
- name: Kill process righting to directory
ansible.builtin.shell: kill -9 `lsof -t /dev/shm`
delegate_to: "{{device}}"
- ansible.builtin.shell: lsof /dev/shm
delegate_to: "{{device}}"
register: lsof
- name: List open files in directory
debug:
msg: '{{lsof.stdout_lines}}'
#
# - name: List of files in directory
# ansible.builtin.shell: ls -la /dev/shm
# delegate_to: "{{device}}"
# register: ls
# - name: List open files in /dev/shm
# debug:
# msg: '{{ls.stdout_lines}}'
# - name: Clear all files in directory
# ansible.builtin.shell: rm -rf /dev/shm`
# delegate_to: "{{device}}"
# - name: List of files in directory after cleaning
# ansible.builtin.shell: ls -la /dev/shm
# delegate_to: "{{device}}"
# register: ls
# - name: List open files in /dev/shm
# debug:
# msg: '{{ls.stdout_lines}}'
#