Groups
Groups
Sign in
Groups
Groups
Ansible Project
Conversations
About
Send feedback
Help
I want to run a specific task in a playbook to a single host. Is there any better way to do that?
15 views
Skip to first unread message
Rajesh Rajendran
unread,
Apr 26, 2018, 4:46:50 AM
4/26/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
custom playbook
---
- hosts: swarm_manager
roles:
- custom_role
roles/custom_role/tasks/main.yml
---
- name: checking for ip
shell: docker service ps service | grep Running | head -n1 | awk '{print $1}'
register: ip
- name: killing the container
**hosts: "{{ip.stdout}}"**
shell: docker kill $(docker service ps | grep service | awk '{print $1}')
Reply all
Reply to author
Forward
0 new messages