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