- name: setup state hosts: testhost connection: local gather_facts: false tasks: - file: path={{playbook_dir}}/files state=directory - file: path={{playbook_dir}}/roles/showfile/files state=directory - copy: dest={{playbook_dir}}/roles/showfile/files/testfile content='in role files' - copy: dest={{playbook_dir}}/roles/showfile/tasks/testfile content='in role tasks' - copy: dest={{playbook_dir}}/roles/showfile/testfile content='in role' - copy: dest={{playbook_dir}}/files/testfile content='in files' - copy: dest={{playbook_dir}}/testfile content='in local' - set_fact: role_out="in role files" play_out="in files" stage='setup' - include: testplay.yml - name: remove from role/files hosts: testhost connection: local gather_facts: false tasks: - file: path={{playbook_dir}}/roles/showfile/files/testfile state=absent - set_fact: role_out="in role tasks" play_out="in files" stage='remove 1' - include: testplay.yml - name: remove from role/tasks hosts: testhost connection: local gather_facts: false tasks: - file: path={{playbook_dir}}/roles/showfile/tasks/testfile state=absent - set_fact: role_out="in files" play_out="in files" stage='remote 2' - include: testplay.yml - name: remove from role dir hosts: testhost connection: local gather_facts: false tasks: - file: path={{playbook_dir}}/roles/showfile/testfile state=absent - set_fact: role_out="in files" play_out="in files" stage='remove 3' - include: testplay.yml - name: remove from play/files hosts: testhost connection: local gather_facts: false tasks: - file: path={{playbook_dir}}/files/testfile state=absent - set_fact: role_out="in local" play_out="in local" stage='remove 4' - include: testplay.yml - name: cleanup hosts: testhost connection: local gather_facts: false tasks: - file: path={{playbook_dir}}/testfile state=absent - file: path={{playbook_dir}}/files state=absent - file: path={{playbook_dir}}/roles/files state=absent