I have a text file that contains some IPs. I want to copy the contents of this text file into
/etc/ansible/hosts without showing the output on the terminal (as shown in example 2).
Note: root user is disabled.
If I use the following:
sudo cat myfile.txt >> /etc/ansible/host
It will not work, since sudo cat didn't affect redirections (expected).
cat myfile.txt | sudo tee --append /etc/ansible/hosts
It will show the output in the terminal then copy them to /etc/ansible/hosts A.A.A.A B.B.B.B C.C.C.C
/dev/nullwill interrupt the result (nothing will be copied to