- hosts:  group    #需要更改密码的组
  remote_user: user1   #ssh登录的普通用户
  become: yes
  become_method: su
  become_user: root   # 需要提前在/etc/ansible/hosts 定义ansible_su_pass
  vars:
   - passwd: password   # 新密码
     User: user2          #需要更改密码的用户
  tasks: 
   - name: change password for {{User}}
     shell: echo '{{passwd}}' |passwd --stdin {{User}}