
# Current working directory should be that of WorkerProcess -- which is the
# same directory as the currently executing playbook, i.e. integration/local/
#
# https://github.com/ansible/ansible/issues/14489

- name: integration/local/cwd_preserved.yml
  hosts: test-targets
  tasks:
  - name: Get local cwd
    vars:
      ansible_python_interpreter: "{{ ansible_playbook_python }}"
    connection: local
    command: pwd
    register: pwd

  - connection: local
    vars:
      ansible_python_interpreter: "{{ ansible_playbook_python }}"
    stat:
      path: "{{pwd.stdout}}/cwd_preserved.yml"
    register: stat

  - assert:
      that: stat.stat.exists
      fail_msg: |
        stat={{ stat }}
  tags:
    - cwd_prseserved
