Re: [ansible-project] How to use the same dictionary to loop over two tasks? is it possible using block?

2018-04-12 Thread Kai Stian Olstad

On 12.04.2018 02:20, Tony Chia wrote:

I would like to do this so that the win_iis_webbinding is called
immediately after win_iis_website instead of calling
win_iis_website,win_iis_website,etc then win_iis_webbinding,
win_iis_webbinding, etc

- block:
  - name: Create IIS site
win_iis_website:
  name:   '{{ item.key }}'
  state: started
  application_pool:   '{{ item.value.application_pool }}'
  physical_path:  '{{ item.value.physical_path }}'
  - name: Bind Site
win_iis_webbinding:
  name:   '{{ item.key }}'
  protocol: https
  ip: '{{ ansible_ip_addresses[0] }}'
  port:   '{{ item.value.http_port }}'
  certificate_hash:   '{{ item.value.cert_thumbprint }}'
  with_dict:"{{ sites }}"
  tags: webapp

However  I got this
ERROR! 'with_dict' is not a valid attribute for a Block


block doesn't support loops.
Too loop over several tasks you need to put the task in a file and use 
include_task: and loop over that.


--
Kai Stian Olstad

--
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/e2834b07e50b9ef9f493fa1649eef375%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to use the same dictionary to loop over two tasks? is it possible using block?

2018-04-11 Thread Tony Chia
I.e. 
instead of doing this which does win_iis_website,win_iis_website,etc then 
win_iis_webbinding,win_iis_webbinding, etc

  - name: Create IIS site
win_iis_website:
  name:   '{{ item.key }}'
  state: started
  application_pool:   '{{ item.value.application_pool }}'
  physical_path:  '{{ item.value.physical_path }}'
with_dict:"{{ sites }}"
  - name: Bind Site
win_iis_webbinding:
  name:   '{{ item.key }}'
  protocol: https
  ip: '{{ ansible_ip_addresses[0] }}'
  port:   '{{ item.value.http_port }}'
  certificate_hash:   '{{ item.value.cert_thumbprint }}'
with_dict:"{{ sites }}"

I would like to do this so that the win_iis_webbinding is called 
immediately after win_iis_website instead of calling 
win_iis_website,win_iis_website,etc then win_iis_webbinding, 
win_iis_webbinding, etc

- block:
  - name: Create IIS site
win_iis_website:
  name:   '{{ item.key }}'
  state: started
  application_pool:   '{{ item.value.application_pool }}'
  physical_path:  '{{ item.value.physical_path }}'
  - name: Bind Site
win_iis_webbinding:
  name:   '{{ item.key }}'
  protocol: https
  ip: '{{ ansible_ip_addresses[0] }}'
  port:   '{{ item.value.http_port }}'
  certificate_hash:   '{{ item.value.cert_thumbprint }}'
  with_dict:"{{ sites }}"
  tags: webapp

However  I got this
ERROR! 'with_dict' is not a valid attribute for a Block

-- 
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/6ec9c113-fbed-46db-9098-cc84a0008b18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.