[call-slack-playbook.yml]
- name: Call Slack test
hosts: api-servers
tasks:
- name: Initial Threaded Slack message
community.general.slack:
channel: '#sre-alarm'
token: xoxb-1231231231-abcde
msg: 'call message from ansible-playbook'
register: slack_response
[Execution]
ansible-playbook call-slack-playbook.yml -i inventory
- hosts: api-servers
gather_facts: no
tasks:
- name: Initial Threaded Slack message
community.general.slack:
channel: '#sre-alarm'
token: xoxb-1231231231-abcde
msg: "executed: run.sh on {{ nodes }}"
register: slack_response
[Execution]
ansible-playbook call-slack-playbook.yml -i inventory --extra-vars "nodes=api-server-1"