Ansible为库存主机发送整合邮件
我试图在多个主机上执行blkid检查,如果任何节点出现任何故障,ansible应该为这些特定主机发送电子邮件。但是我要为每个主机单独接收邮件,而不是将所有失败的主机都放在一封邮件中 有什么帮助吗 main.ymlAnsible为库存主机发送整合邮件,ansible,ansible-inventory,ansible-facts,ansible-template,Ansible,Ansible Inventory,Ansible Facts,Ansible Template,我试图在多个主机上执行blkid检查,如果任何节点出现任何故障,ansible应该为这些特定主机发送电子邮件。但是我要为每个主机单独接收邮件,而不是将所有失败的主机都放在一封邮件中 有什么帮助吗 main.yml - name: check blkid block: - name: checking blkid on multiple hosts shell: /sbin/blkid failed_when: cmd.rc != 0 regist
- name: check blkid
block:
- name: checking blkid on multiple hosts
shell: /sbin/blkid
failed_when: cmd.rc != 0
register: cmd
tags:
- checkblkid
rescue:
- name: send email for command execution failed hosts
mail:
host: localhost
to: xxxx@gmail.com
subject: list of hosts blkid not found
subtype: html
body: "{{ inventory_hostname }}"
delegate_to: localhost
tags:
- checkblkid