ansible slack 模块的问题

issue with ansible slack module

我正在尝试将 slack 模块与 ansible 2.1 一起使用。我创建了一个 slack api 令牌(今天重新创建它进行测试)并在角色的任务中使用它。但是,当任务被调用时,我收到以下复制的错误:

- name: Send notification message via Slack all options
  local_action:
    module: slack
    token: "test-12121212121-12121212121-121212121-thiswasgeneratedtoday"
    msg: "{{ inventory_hostname }} completed"
    channel: "#valid-slack-channel-name"
    username: "valid-slack-user-name"
   # parse: 'none'

错误

fatal: [localhost -> localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"attachments": null, "channel": "#slack-channel-test", "color": "normal", "domain": null, "icon_emoji": null, "icon_url": "http://www.ansible.com/favicon.ico", "link_names": 1, "msg": "localhost completed", "parse": null, "token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "username": "valid-user", "validate_certs": true}, "module_name": "slack"}, "msg": "Slack has updated its webhook API.  You need to specify a token of the form XXXX/YYYY/ZZZZ in your playbook"}

将域添加到任务后,我收到以下复制的错误:

"msg": " failed to send payload={\"username\": \"valid-slack-user-name\", \"text\": \"localhost completed\", \"link_names\": 1, \"channel\": \"#valid-slack-channel-name\", \"icon_url\": \"http://www.ansible.com/favicon.ico\"} to https://hooks.slack.com/services/[obscured]: HTTP Error 404: Not Found"

确保以正确的格式指定令牌。
这在 Ansible 2.1.2.0 中对我来说很好用:

- local_action:
    module: slack
    token: "QWERTYUIO/ASDFGHJKL/klwerisSDFBhwrekjhskdjfd"
    msg: "{{ inventory_hostname }} completed"
    channel: "@mynickname"