1
2.1과 슬랙 모듈을 사용하려고합니다. 나는 느슨한 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"
감사 -하지 슬래시 - 나는 여유에서 얻는 시험 토큰은 대시가 있습니다. –
@alihaider [incoming webhook] (https://api.slack.com/incoming-webhooks) 토큰을 요청 하시겠습니까? 그것은'https : // hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX' 포맷을 가지고 있습니다. –
oauth 토큰을 사용하고 있었고 대신 webhook 통합 URL을 사용해야했습니다. 여기에서 테스트하고 업데이트 할 것입니다 - spaciba –