O'Reilly logo
  • William Yeh thinks this is interesting:

The first task will be to disable the host from the load balancer. The load balancer runs on the foo-lb host; however, we're operating on the foo-app hosts. Therefore, we need to delegate the task using the delegate_to task operator. This operator redirects where Ansible will connect in order to execute the task, but keeps all the variable context of the original host. We'll use the haproxy module to disable the current host from the foo-app backend pool:

    - name: disable member in balancer


Cover of Mastering Ansible


"delegate_to" 很好用。