---

- name: A simple playbook in finish phase
  hosts: all
  vars:
    simple: "{{ lookup('env', 'SIMPLE') }}"
    spaces: "{{ lookup('env', 'SPACES') }}"
  tasks:
    - name: Create a simple test file
      ansible.builtin.copy:
        dest: /tmp/finished
        content: pass
        mode: preserve

    - name: Make sure a simple environment variable is respected
      ansible.builtin.command: echo "SIMPLE='{{ simple }}'"
      failed_when: simple != 'word'
      changed_when: false

    - name: Make sure variables with spaces are correctly handed over
      ansible.builtin.command: echo "SPACES='{{ spaces }}'"
      failed_when: spaces != 'several words with spaces'
      changed_when: false
