标签:高级管理
查看组内主机列表
ansible webservers --list-hosts
-m shell# ansible all -m shell -a ‘hostname‘
-m copy# ansible all -m copy -a ‘src=/etc/hosts dest=/etc/hosts‘
-m user添加用户
# ansible all -m user -a "name=lala password=123"删除用户
# ansible web1 -m user -a "name=lala state=absent"
-m yum删除软件
# ansible web1 -m yum -a ‘name=httpd state=removed‘安装软件
# ansible web1 -m yum -a ‘name=httpd state=latest‘
-m service# ansible webservers -m service -a ‘name=httpd state=started‘
# ansible web1 -m setup -a
标签:高级管理
原文地址:http://blog.51cto.com/13523939/2074022