Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- You should install `python-pexpect` for `expect` module in ansible.
- ```yaml
- - hosts: 127.0.0.1
- tasks:
- - name: change expire passwd
- become: no
- expect:
- command: ssh {{ ansible_ssh_common_args }} {{ ansible_user }}@{{ item }}
- timeout: 10
- responses:
- "password:":
- - "{{ ansible_ssh_pass_old }}"
- - "{{ ansible_ssh_pass_old }}"
- - "{{ ansible_ssh_pass }}"
- - "{{ ansible_ssh_pass }}"
- "\\~\\]\\$": exit
- register: status
- changed_when: "'authentication tokens updated successfully' in status.stdout"
- with_items: "{{ groups['delivery-new'] }}"
- ```
Add Comment
Please, Sign In to add comment