It fails with: fatal: [theforeman.example -> localhost]: FAILED! => {"changed": false, "msg": "Failed to connect to Foreman server: OSError: [Errno 13] Permission denied: '/usr/share/foreman-proxy/.cache'"}
The issue happens because of “delegate_to”. Using theforeman.foreman.setting is just an example.
A possible solution would be, to create a link from /usr/share/foreman-proxy/.cache to /var/tmp and set “foreman-proxy” / chmod 750 as permission rights.
It’s not an issue of the delegate_to, but the fact that the Ansible module (theforeman.foreman.setting) wants to write to ~/.cache/ (for the apidoc cache) on whatever host it’s running against and can’t.
Yes, you can create that link. Or set XDG_CACHE_HOME.
Because it then uses SSH and gets a different $HOME? Maybe even on a different machine? My crystal ball is used up for today
It will also not occur if you replace theforeman.foreman.setting with a module that is not from theforeman.foreman and thus doesn’t try to write to ~/.cache/apypie/, like, uh, the copy module.