Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ansible/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ansible为库存主机发送整合邮件_Ansible_Ansible Inventory_Ansible Facts_Ansible Template - Fatal编程技术网

Ansible为库存主机发送整合邮件

Ansible为库存主机发送整合邮件,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

我试图在多个主机上执行blkid检查,如果任何节点出现任何故障,ansible应该为这些特定主机发送电子邮件。但是我要为每个主机单独接收邮件,而不是将所有失败的主机都放在一封邮件中

有什么帮助吗

main.yml

- 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