Ansible 检查文件夹的磁盘空间

问题描述

一个模块可以让我像命令 override public func draw(_ rect: CGRect) { super.draw(rect) for (i,time) in times.enumerated() { let fontSize = style.font.pointSize let timeRect = CGRect(x: 2,y: y,width: style.leftInset,height: fontSize) let timeString = Nsstring(string: time) timeString.draw(in: timeRect,withAttributes: attributes) } } 一样检查文件夹的磁盘空间?
我想避免使用 shell 或命令模块,我不敢相信它没有模块

解决方法

经过对文档的一些研究,似乎由于某种原因没有模块,因为您要查找的信息已经是 gathered within the facts(搜索 ansible_mounts)。

对于 device 中的每个 ansible_mounts,您将获得 size_availabesize_total。对于找到的第一个挂载点,您可以使用像

这样的构造
- set_fact:
    mount: "{{ ansible_mounts | first }}"

- set_fact: 
    disk_usage: "{{ mount.size_total - mount.size_available }}"

找出disk_usage

归功于