Skip to content

Instantly share code, notes, and snippets.

@toast38coza
Created July 23, 2017 23:00
Show Gist options
  • Save toast38coza/71acd931acc30c14c5c213dc34f10009 to your computer and use it in GitHub Desktop.
Save toast38coza/71acd931acc30c14c5c213dc34f10009 to your computer and use it in GitHub Desktop.
Ansible to run code only on a single manager node
- hosts: server_swarm
tasks:
- command: "docker info --format '{%raw%}{{json .Swarm.ControlAvailable}}'{%endraw%}"
register: result
become: true
- debug: msg='Deploy on this host'
when: result.stdout == 'true'
run_once: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment