Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
913
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. ---
  2. - name: enable shh
  3. hosts: routers
  4. gather_facts: false
  5. connection: local
  6.  
  7. tasks:
  8.  
  9. - name: check ssh
  10. command: /usr/bin/python /root/ansible/check_port.py "{{ansible_host}}" 22
  11. register: ssh_listen
  12. ignore_errors: True
  13.  
  14.  
  15. - name: enable_ssh
  16. telnet:
  17. user: vooray
  18. password: passwd
  19. login_prompt: "Username: "
  20. prompts:
  21. - "[>|#]"
  22. command:
  23. - term le 0
  24. - conf t
  25. - ip domain-name lab.local
  26. - crypto key generate rsa modulus 1024
  27. - ip ssh version 2
  28. - exit
  29. - wr mem
  30. - exit
  31. when: ssh_listen|failed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement