二、使用ansible在多台机器上添加用户react
须要如今/etc/ansible/hosts中定义主机清单,ip或者主机名均可以,一个ip能够属于多个主机 [web] 10.0.0.201 10.0.0.202 [db] 10.0.0.203 [lamp] 10.0.0.201 10.0.0.203
可使用user模块 ansieble all -m user -a "name=a1" 也可使用shell模块 ansible all -m shell -a "useradd a1"
ansible lamp -m shell -a "useradd apache"