- name: integration/runner/missing_module.yml
  hosts: test-targets[0]
  connection: local
  tasks:
    - name: Run missing_module
      connection: local
      environment:
        ANSIBLE_STRATEGY:  "{{ lookup('env', 'ANSIBLE_STRATEGY') | mandatory }}"
        ANSIBLE_VERBOSITY: "{{ ansible_verbosity }}"
      vars:
        ansible_python_interpreter: "{{ ansible_playbook_python }}"
      command: |
        ansible
        {% for inv in ansible_inventory_sources %}
        -i "{{ inv }}"
        {% endfor %}
        test-targets
        -m missing_module
      args:
        chdir: ../..
      register: out
      changed_when: false
      check_mode: false
      ignore_errors: true

    - assert:
        that: |
          'The module missing_module was not found in configured module paths' in out.stdout
          or "Cannot resolve 'missing_module' to an action or module" in out.stdout
        fail_msg: |
          out={{ out }}
  tags:
    - local
    - missing_module
