What if the task for zone file templates is a in a later play where you
might limit the targeted hosts by an external variable you pass from the
ansible-playbook command, and run another prior play for all hosts that you
need in another play above it. not a clean solution, but will possibly work


On 12 February 2014 05:36, Christopher O'Connell <c...@fasttcp.com> wrote:

> Hello all,
>
> I'm currently wrestling with creating DNS zonefiles when running a
> playbook which uses tempates to set NS authority records based on the
> members of the 'dns' group.
>
> Consider the template snippet:
>
> {% for host in groups['dns-edge'] %}
> {% if hostvars[host]['ansible_default_ipv4'] is defined %}
> {{ domain }}    IN    NS    {{
> hostvars[host]['ansible_default_ipv4']['address'] }}
> {% endif %}
> {% endfor %}
>
> You'll notice the extra if statement in there. The problem is that if
> --limit is applied when the playbook is run, it only will render out a
> single NS record instead of the whole list of machines in the dns group,
> since gather_facts hasn't been run on those machines.
>
> Question: Is there anyway to force ansible to run gather facts on the
> whole group even if limit is applied on the command line.
> Follow up: If not, can anyone think of a way of doing this without
> defining some global like "dns_authoritative_server" containing a static
> list?
>
> All the best,
>
> ~ Christopher
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to