[ansible-project] Possible approaches to iteration

2018-04-09 Thread tom . reynick
I would like to understand semantics of `with_items` in ansible and compare 
this approach to `map` for example. 

For example, let consider:  

`{{ ["1","2", "3"]  | map('regex_replace', '^(.*)$', \1'some tail')  tail 
}}`

How to reach the same effect using `with_items` ? 
And in general how does it work ? Where is the body of this loop ?
For example (got from some stack overflow thread):

---
- hosts: localhost
  tasks:
  - name: set fact 1
set_fact: foo="[ 'zero' ]"

  - name: set fact 2
set_fact: foo="{{ foo }} + [ 'one' ]"

  - name: set fact 3
set_fact: foo="{{ foo }} + [ 'two', 'three' ]"

  - name: set fact 4
set_fact: foo="{{ foo }} + [ '{{ item }}' ]"
with_items:
  - four
  - five
  - six

  - debug: var=foo

To sum up, the question is about which approach is better (`map` vs 
`with_items`) and possible details of working (e.g. where  is body of this 
loop) 
Each detail of working ansible is welcome!

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3be9928e-c824-4934-bbec-4e813dd54505%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] map vs with_items

2018-04-09 Thread tom . reynick
I would like to understand semantics of `with_items` in ansible and compare 
this approach to `map` for example. 

For example, let consider:  

`{{ ["1","2", "3"]  | map('regex_replace', '^(.*)$', \1'some tail')  tail 
}}`

How to reach the same effect using `with_items` ? 
And in general how does it work ? Where is the body of this loop ?
For example (got from some stack overflow thread):

---
- hosts: localhost
  tasks:
  - name: set fact 1
set_fact: foo="[ 'zero' ]"

  - name: set fact 2
set_fact: foo="{{ foo }} + [ 'one' ]"

  - name: set fact 3
set_fact: foo="{{ foo }} + [ 'two', 'three' ]"

  - name: set fact 4
set_fact: foo="{{ foo }} + [ '{{ item }}' ]"
with_items:
  - four
  - five
  - six

  - debug: var=foo

To sum up, the question is about which approach is better (`map` vs 
`with_items`) and possible details of working (e.g. where  is body of this 
loop) 
Each detail of working ansible is welcome!

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/70e4f30e-b8b7-4d2f-807a-c10d5fbde686%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ansible_processor_vcpus - What does mean this value ?

2018-03-13 Thread tom . reynick
Hi,  
can someone try to explain what does it mean *ansible_processor_vcpus ?*
How does it refer to number of cores, number of threads and so on.  What 
about HT capability of processor ?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cc94416a-9dac-492b-9185-110e920219bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.