--- - name: Write the inventory files for the included test cases hosts: localhost gather_facts: no vars: ansible_connection: local tasks: - set_fact: threescale_inventory: '{{ lookup(''env'', ''THREESCALE_INVENTORY'')|b64decode|from_json }}' when: 'threescale_inventory is not defined and lookup(''env'', ''THREESCALE_INVENTORY'')|length > 0' - set_fact: threescale_inventory: '{{ lookup(''file'', ''{{ playbook_dir }}/3scale-inventory.yaml'')|from_yaml }}' when: 'threescale_inventory is not defined' - name: Process the Jinja2 templates template: src: '{{ playbook_dir }}/inventory.j2' dest: '{{ playbook_dir }}/environments/{{ item.key }}' with_dict: '{{ threescale_inventory }}' vars: test_environment: '{{ item.value }}'