count

The count filter will return the length of a sequence or hash. In fact, length is an alias of count to accomplish the same thing. This filter can be useful for performing any sort of math around the size of a set of hosts, or any other case where the count of some set needs to be known. Let's create an example where we set a max_threads configuration entry to match the count of hosts in the play:

max_threads: {{ play_hosts | count }} 

This provides us with a nice, concise way of getting the number of hosts contained within the play_hosts variable, and assigning the answer to the max_threads variable.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.122.4