Reputation: 33
Consider next scenario: multiple hosts needs to be configured independently. At some point in time, after ALL configuration tasks on ALL hosts been completed successfully, some final tasks needs to be run on ONLY ONE host. what would be the proper solution for ansible playbook ?
Upvotes: 3
Views: 5852
Reputation: 7887
Use run_once
for that: http://docs.ansible.com/ansible/latest/user_guide/playbooks_delegation.html#run-once
Example:
---
- hosts: all
tasks:
- command: echo preparing stuff on all hosts
- command: echo run only on single host
run_once: True
Upvotes: 3