我在Ansible中有以下脚本:
--- #Available RAM
- hosts: all
sudo: yes
user: ansible
connection: ssh
vars:
RAM: ansible_memory_mb.real.total
tasks:
- fail: msg="Not enough RAM"
when: ansible_memory_mb.real.total < 100
ignore_errors: yes
tags: available_ram
- name: Basic checks
template: src=../templates/template.conf.j2 dest=/home/ansible/monit{{ansible_hostname}}.log owner=ansible mode=750
以下Jinja2 conf文件将创建.log文件:
{{ansible_hostname}} RAM available: {{ansible_memory_mb.real.total}}mb
是否有任何方法可以将日志文件中的结果着色,如果没有足够的RAM可用?
祝你好运, 丹