Created
July 23, 2017 23:00
-
-
Save toast38coza/71acd931acc30c14c5c213dc34f10009 to your computer and use it in GitHub Desktop.
Ansible to run code only on a single manager node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - 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