I have a kickstart file on a remote machine to which I would like to add the ssh key of the user of the remote machine without having that pub file locally. My plan is to add a shell section to the ansible playbook to perform this task. So far my testing was havin 2 files and replacing the required section using sed. I have the following:
file1:
aaa
bbb
text "REPLACE"
ccc
file2:
1233456
using sed -i "s@REPLACE@$(cat file2)@g" file1 it replaces the text.
However when I add the absolute path sed -i "s@REPLACE@$(cat /home/me/test/file2)@g" /home/me/test/file1 the command fails.
What could solve this problem?
edit: to clarify the ansible is provisioning the remote machine for various tasks amongst which is PXE boot server. the solution using ansible replace works very nice in this case.