@gothsome Are you trying to copy a file local to the remote host or local to AWX? You’re trying to copy agent.cfg from /tmp/ to /root/, but delegate_to: localhost
tells the module to run against the ansible controller (your awx job execution pod), which may not exist or be where you want this to run.
You might be trying to do this:
---
- name: copy
hosts: all
gather_facts: no
tasks:
- name: copy
become: true
ansible.builtin.copy:
src: /tmp/agent.cfg
dest: /root/agent.cfg
owner: root
group: root
mode: '0644'
remote_src: true