I tried to look at documentation and code of GitHub, including ee ansible scripts Is there already made script to clean up files in /var/openebs? I mean deleted PVs Something like: kubectl get pv --no-headers -o custom-columns=:metadata.name and then delete the rest of pack
问问题
53 次
1 回答
0
查看此信息,您似乎正在运行 0.7.2 版本以下的代码。高于 0.7.2 的 OpenEBS 版本代码处理一个作业,该作业将在节点上调度以清除数据。但是,如果您想在旧版本中进行清理,请从 OpenEBS 社区用户那里获得此代码,他们有以下示例代码
- hosts: localhost
tasks:
- name: Get list of volumes
shell: kubectl get pv --no-headers -o custom-columns=:metadata.name
args:
executable: /bin/bash
check_mode: no
register: volume_list
- debug: var=volume_list
- hosts: all
tasks:
- name: get files in path
find:
path: /var/openebs
recurse: no
file_type: directory
patterns: 'pvc-*'
register: path_files
- name: Delete volumes
file:
path={{ item.path }}
state=absent
with_items: " {{ path_files.files }} "
when: item.path | basename not in hostvars['localhost']['volume_list']['stdout_lines']
于 2019-01-31T09:25:43.410 回答