- hosts: localhost gather_facts: false connection: local tasks: - name: Find all module files find: paths: "{{ playbook_dir }}/plugins/modules" patterns: "*.py" register: module_files - name: Change module_utils imports to absolute namespace and package names replace: path: "{{ item.path }}" regexp: '^from ..module_utils.ansible_tower' replace: 'from ansible_collections.awx.awx.plugins.module_utils.ansible_tower' with_items: "{{ module_files.files }}"