Guest User

Untitled

a guest
Jan 22nd, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. You should install `python-pexpect` for `expect` module in ansible.
  2.  
  3. ```yaml
  4. - hosts: 127.0.0.1
  5. tasks:
  6. - name: change expire passwd
  7. become: no
  8. expect:
  9. command: ssh {{ ansible_ssh_common_args }} {{ ansible_user }}@{{ item }}
  10. timeout: 10
  11. responses:
  12. "password:":
  13. - "{{ ansible_ssh_pass_old }}"
  14. - "{{ ansible_ssh_pass_old }}"
  15. - "{{ ansible_ssh_pass }}"
  16. - "{{ ansible_ssh_pass }}"
  17. "\\~\\]\\$": exit
  18. register: status
  19. changed_when: "'authentication tokens updated successfully' in status.stdout"
  20. with_items: "{{ groups['delivery-new'] }}"
  21. ```
Add Comment
Please, Sign In to add comment