--- - name: generate configuration for stock firmware hosts: - switches_stock gather_facts: no connection: local tasks: - name: create output directory file: state: directory path: switch-configs-stock/ - name: generate configuration template: src: templates/{{ sw_type }}-stock.cfg.j2 dest: "switch-configs-stock/{{ inventory_hostname }}.cfg"