I would like to copy a file on a host local fs without having to worry which folder is used.
i have a test file which i want to copy from tmp to root which doesnt function.
I have read that the permissions for the user which runs the playbooks need to have access, because the become: yes is not in this case helpful.
my last test version which contains everything i thought would be necessary still fails:
When i use the Playbook from you i get this error which makes me think like the playbook looks the filesystem of itself, but not the host and i got the same errors in the beginning:
@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.
I DL the file to at first it was /temp from a git onto the host and then copy it to the folder of the application in my case: /etc/fusioninventory/agent.cfg.
everything is happening on each host.
I guilding an installer playbook for Fusioninventory and the only part thats not cooperative is the replacing of the cofig file.
Maybe you have another idea how to address this idea?
I thought you need the remote src for network shares.
or do i have a wrong view and the normal viel of every playbook is the awx machine and when smth need to happen at the hosts its a remote thing?
The documentation at ansible.builtin.copy says this for the remote_source parameter.
Influence whether src needs to be transferred or already is present remotely.
If false, it will search for src on the controller node.
If true it will search for src on the managed (remote) node.
remote_src supports recursive copying as of version 2.8.
remote_src only works with mode=preserve as of version 2.6.
Autodecryption of files does not work when remote_src=yes.
Choices:
false ← (default)
true
Terminology
controller node The system that ansible was launched from. If using ansible-core (command line), that’s the system you ran the CLI command from. If using AWX/AAP, its the execution environment node in your installation.
managed node The system that is the target of the play. No matter where you launch ansible from, the managed node is always the same for a given playbook, play, or task.
Explanation
Based on the terminology above and the remote_source parameter details, if you do not set this parameter or set it to false then ansible tries to find the file/directory specified by the src parameter on the system running ansible (controller node).
If you set remote_source to true, ansible tried to find the file on the target system (managed node).
THank you!
Ill read into this a little more.
It seems that al lot of ppl. get the same error in thinking.
I even found a Copy file playbook where somebody streamed the content of the file to the AWX and writes into the desired file.
An idea i would never have thought of just to replace a file
And i found some roles for copying but some of them where a little to complicated to understand and the installation is not so clear (think need entry in project requirement file and dl the Role into the Git).