I've got a case where I'd like to delegate contents of entire role over to 
another box. Adding "delegate_to" to every task seems strenuous and not 
reusable since I may use this role without delegation.

My attempt at simulating what is done with { role: X, tags: A } did not 
succeed:

$ cat roles/delegated_role/tasks/main.yml   
---

- name: Simple echo
  shell: hostname
  # delegate_to: "{{ central_server }}"

$ cat test_delegate.yml 
---

- hosts: all
  roles:
  - { role: delegated_role, delegate_to: "{{ central_server }}" }

yet invocation with 

$ ansible-playbook -vvv -u root -e 'central_server=foo.bar' -i inventory 
test_delegate.yml

yields results obtained from the server mentioned and not from 
'delegated_to'. Obviously uncommenting "delegate_to" line within a role 
yields desired results but that means I can't reuse and it's a copy-paste 
exercise to transfer a role into a delegated role.

Am I doing it the wrong way? Am I applying a wrong pattern here or is there 
a different way to blanket-apply things like that?

-- 
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/d7b32c05-6ab4-4c98-a7b0-54779631371e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to