--- # tasks file for shelly_shutter # - name: shelly_shutter | configure as shutter uri: url: "http://{{ ansible_host }}/settings?mode=roller" method: GET register: basic tags: - configuration - debug: msg: "{{ lookup('dict',basic) }}" verbosity: 1 - debug: msg: "{{ basic['json']['device'] }}" verbosity: 1 - name: shelly_shutter | run per_shutter tasks # https://www.reddit.com/r/ansible/comments/6zt66i/looping_over_a_block_of_tasks/ include: "per_shutter.yml current_shutter={{ cur_shutter }}" loop_control: loop_var: cur_shutter loop: "{{ range(0,basic.json.device.num_rollers)|list }}" # https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#standard-loops