ansible]# vim user.yml
---
- hosts: cache
remote_user: root
vars:
username: lisi
tasks:
- name: create user "{ {username}}"
user: group=wheel uid=1000 name={ {username}}
- shell: echo 123456 | passwd --stdin { {username}}
- shell: chage -d 0 { {username}}
ansible]# ansible-playbook user.yml //执行结果