---

- name: Testing Playbook
  hosts: all
  gather_facts: no

  tasks:
    - name: Test task
      register: test_msg
      changed_when: "'Test' in test_msg.stderr"
      shell: echo 'Test'
---

- name: Testing Playbook
  hosts: all
  gather_facts: no
  connection: local

  tasks:
    - name: Test task
      register: test_msg
      changed_when: "'Test' in test_msg.stderr"
      shell: echo 'Test'
Use Ansible's local connection option for tests
Use Ansible's local connection option for tests
