On Tuesday, 18 April 2017 22:34:20 UTC+5:30, Kai Stian Olstad wrote: > > On 18. april 2017 18:25, nishant bawane wrote: > > 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 > > -- > Kai Stian Olstad >
-------------- I tried using script module to run the single scp command, but it is not working. My script file(abc.sh) contains below scp command - #!/bin/bash scp /home/capio/ansible/pmossWipm/day1/playbooks/xyz.yml [email protected]:/home/user My YML Looks like below - --- - hosts: testserver tasks: - name: "run the script" script: /home/capio/ansible/pmossWipm/day1/scripts/abc.sh ----------------------------------------------------------------------------------------------------------------------------------------------- Error getting is as per below- It is getting stuck here only and hence not proceeding. Please suggest what exactly needs to be done! -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/06191875-822e-46b9-b47b-616cc738aeed%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
