I am trying to get a playbook to run the open-scap scanner but I need those results on the remote host to be copied over to a network share I am trying something like this but getting “permission denied”
`
name: find it
find:
path: /tmp/
patterns: ‘_oscap_results.html,_oscap_arf.xml’
register: oscap_results
name: copy it
fetch:
src: “{{ item.path }}”
dest: /mnt/SCAP/
I am assuming you cut out a line too early and that you are looping over the oscap_resultfor the last line there. You also do not mention where and how the network share is mounted. The fetch module copies the file from the remote to the local node. So it is equivilant to running "scp {{ansible_user}}@{{ansible_ssh_address}}:/tmp/*_oscap_results.html /mnt/SCAP/{{ansible_hostname}}/tmp/". So make sure that /mnt/SCAP/ is mounted on the node you are running ansible from and that you have the permission to create files and directories there. You might also look at the "copy" module with "remote_src: True" if the network share is mounted on the remote node.