Hi Filip,

No problem!

No, not every Python function is available in Jinja.  In that example, you
see we can use any method associated with string in Jinja, because the
string is still an object, and it's methods come with it.  Just remember
that you always have access to the objects methods.

For future reference, by the way, the list of standard Jinja filters are
here: http://jinja.pocoo.org/docs/templates/#builtin-filters
I'm actually not sure if all the Ansible filters are documented in a single
place, but IIRC they are all in the following Python file:
https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/filter_plugins/core.py



On Mon, Mar 31, 2014 at 1:04 PM, Filip Slunecko <[email protected]>wrote:

> Thank you!
>
> I tried jinja filters and they do not work :).
> I assume I can use any python function there right?
>
>
> On Monday, March 31, 2014 7:28:11 AM UTC-7, Paul Durivage wrote:
>
>> Hi Filip,
>>
>> You'll find that calling the split method on the string works.
>>
>> See this Gist:  https://gist.github.com/angstwad/9893480
>>
>>  12345678910
>>
>> ---
>> - name: Test split
>>
>>   hosts: localhost
>>   gather_facts: false
>>
>>   vars:
>>     - facter_blockdevices: "sda,sdb,sdc,sdd,sde,sdf"
>>
>>   tasks:
>>     - name: Let's split
>>
>>       debug: var=item
>>       with_items: "facter_blockdevices.split(',')"
>>
>>
>>
>>
>> On Fri, Mar 28, 2014 at 10:41 PM, Filip Slunecko <[email protected]>wrote:
>>
>>> Hi all,
>>>
>>> Is there a way how ti easily iterate over facter_blockdevices?
>>>
>>> Example:
>>>
>>>       - name: checking disks for failure
>>>         command:  /usr/sbin/smartctl /dev/{{ item }}
>>>         with_items: facter_blockdevices
>>>         register: smart_out
>>>
>>> Facts:
>>> "facter_blockdevices": "sda,sdb,sdc,sdd,sde,sdf",
>>>
>>> Thanks!
>>>
>>> Filip
>>>
>>> --
>>> 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/fa84c84b-b4d8-4cd7-a8d7-
>>> 894df146c8a6%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/fa84c84b-b4d8-4cd7-a8d7-894df146c8a6%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 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/48ab23b2-5961-41be-a2b2-c806680e13ca%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/48ab23b2-5961-41be-a2b2-c806680e13ca%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 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/CAK6JQEF1OvGRn1N7fUnBnQv-UV6Y6rcMDBTkN9U%3DwcPS40mZ%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to