For "How do I iterate within a playbook" I recommend reading the looping information in the documentation.
On Sat, Nov 23, 2013 at 7:42 AM, Gonzalo Servat <[email protected]> wrote: > I don't have an issue with the template itself. I was asking how I can > iterate within the playbook over some (not all) of the network interfaces > in the system (the ones I have defined a config for), since roles/includes > + with_items is not recommended. > > - GS > > > On Sat, Nov 23, 2013 at 8:12 AM, Michael DeHaan > <[email protected]>wrote: > >> I'd start by reading the template information: >> http://jinja.pocoo.org/docs/ >> >> >> >> On Thu, Nov 21, 2013 at 10:21 PM, Gonzalo Servat <[email protected]>wrote: >> >>> Hi James, >>> >>> >>> On Wed, Nov 13, 2013 at 1:00 AM, James Tanner <[email protected]>wrote: >>> >>>> I would suggest starting with building a role that takes in a few >>>> inputs: >>>> >>>> * nic number >>>> * nic mac address >>>> * routes >>>> >>>> The role should then create the necessary config files from templates. >>>> I suggest a role because you do a lot of little tasks to achieve the goal >>>> instead of trying to have everything happening in one task in a top level >>>> playbook. >>>> >>> OK so say I have a role defined and I can call it like so: >>> >>> { role: nic_config, name=<nicname>, mac=<mac>, routes=[<routes>] } >>> >>> How would I then iterate the list of NICs in the system (i.e. >>> ansible_interfaces) and only set-up NICs that have been specified (in >>> Ansible) for the host (if that makes sense)? What I'm trying to say is that >>> while the system may have many network interfaces (in ansible_interfaces), >>> I may only want to configure a subset of them as per what has been defined >>> in the Ansible inventory for that host. >>> >>> GS >>> >>> -- >>> 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]. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> >> >> -- >> Michael DeHaan <[email protected]> >> CTO, AnsibleWorks, Inc. >> http://www.ansibleworks.com/ >> >> -- >> 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]. >> 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 [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- Michael DeHaan <[email protected]> CTO, AnsibleWorks, Inc. http://www.ansibleworks.com/ -- 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]. For more options, visit https://groups.google.com/groups/opt_out.
