Sounds interesting! Thanks for the suggestion!
2014-08-07 23:16 GMT+02:00 Michael DeHaan <[email protected]>: > For dictionaries, you can use ".keys()" to get all of them. There is also > ".iteritems()" which returns a tuple of both the key and the value. > > > > > On Wed, Aug 6, 2014 at 6:58 AM, Valentino Gagliardi < > [email protected]> wrote: > >> Hello friends >> >> I've some lists of elements which contains values like plugin: >> "someplugin", directive: "somedirective". For reference see >> >> Variables: >> https://github.com/valentinogagliardi/collectd/blob/master/README.md#example-playbook >> >> Template: >> https://github.com/valentinogagliardi/collectd/blob/master/templates/collectd.conf.j2 >> >> At this moment I'm able to generate a configuration which take this form: >> >> <Plugin "someplugin"> >> somedirective >> </Plugin> >> >> <Plugin "anotherplugin"> >> anothersomedirective >> </Plugin> >> >> What if I want to add more directives to the list? >> >> plugins: >> - { plugin: "someplugin", directive: "somedirective" } >> - { plugin: "anotherplugin", directive: "somedirective", directive_x: >> "anotherdirective" } >> >> Is not clear to me how to loop over all elements when elements are not >> known in advance, in order to generate a configuration like this: >> >> <Plugin "someplugin"> >> somedirective >> </Plugin> >> >> <Plugin "anotherplugin"> >> somedirective >> anotherdirective >> </Plugin> >> >> Thanks in advance! >> >> -- >> 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/7b0ca845-74bb-4b9b-b0c0-79c376c75f98%40googlegroups.com >> <https://groups.google.com/d/msgid/ansible-project/7b0ca845-74bb-4b9b-b0c0-79c376c75f98%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/O_6gyS5DvJ8/unsubscribe. > To unsubscribe from this group and all its topics, 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/CA%2BnsWgxGthrF6QSiSKsf4fKGiVtQJo7v4C3z-bmGDk8Y6SGVjw%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgxGthrF6QSiSKsf4fKGiVtQJo7v4C3z-bmGDk8Y6SGVjw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAJne%3DXqS6S0TNzOXAmmtqex%2BBB3VBweYwNAYtEGsQvyLqTCU-Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
