Ansible错误:smtp.office365.com:587的身份验证失败,请检查您的用户名和/或密码

Ansible错误:smtp.office365.com:587的身份验证失败,请检查您的用户名和/或密码,ansible,Ansible,我遇到了这个错误,虽然它说身份验证失败,但我的用户名和密码绝对正确 "from": "maryam.mustaffa@xx.com.sg", "headers": [], "host": "smtp.office365.com", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "port": 587,

我遇到了这个错误,虽然它说身份验证失败,但我的用户名和密码绝对正确

            "from": "maryam.mustaffa@xx.com.sg",
            "headers": [],
            "host": "smtp.office365.com",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 587,
            "secure": "try",
            "sender": "maryam.mustaffa@xx.com.sg",
            "subject": "AD Replication Check - 2019-12-16",
            "subtype": "html",
            "timeout": 20,
            "to": [
                "maryam.mustaffa@xx.com"
            ],
            "username": "maryam.mustaffa@xx.com.sg"
        }
    },
    "msg": "Authentication to smtp.office365.com:587 failed, please check your username and/or password",
    "rc": 1
我在谷歌上搜索过,似乎找不到解决办法。 编辑:很抱歉,我完全忘记在我的剧本中添加:

  mail:
    attach: /tmp/{{ attachment }}
    subject: "{{ subject }}"
    host: smtp.office365.com
    port: 587
    body: "{{ email_body }}"
    username: maryam.mustaffa@ncs.com.sg
    password: _Leodanielandra1
    from: maryam.mustaffa@ncs.com.sg
    to: "{{ recipient }}"
    subtype: html
    secure: starttls
  delegate_to: localhost
  become_method: sudo
  become_user: root

就像笑眯眯地说的;始终提供示例代码。也就是说,smtp.office365.com可能不喜欢加密设置。默认值为“try”,通过添加以下内容来否决:

 secure: starttls

请贴上标签playbook@smily您好,很抱歉我在hi中添加了它,我更改了安全类型,但它仍然给出了完全相同的错误:/