Ansible: Need to understand how can we use scp and ssh command with shell or script.

for i in cat /tmp/list
do
echo $i
scp HLC_auth $i:.ssh/authorized_keys
scp known_hosts.LLC $i:.ssh/known_hosts
ssh $i “rm -rf .ssh/id_dsa*”
ssh $i “ssh-keygen -d”
done
Above the the task i need to run through playbook, please suggest how the playbook should look alike.

below is the code which run succesfully when i exclude scp and ssh commands -

shell: for i in cat /home/dp794d/temp/list;
do echo $i;
done

Need to include the scp and ssh command also under the same shell… how to perform that task.

There is many ways to do this, but you should probably start with the script module until you get some experience with Ansible
https://docs.ansible.com/ansible/script_module.html

(attachments)

Auto Generated Inline Image 1.png

This is not a Ansible problem, so you might have better luck in a more bash/shell/ssh related community.

The only hint I will give you is to make that work you would need passwordless ssh keys in place.