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}')


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4a110ee3-a5d0-40c0-9362-d4f0bca5bbf4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to