标签:
ansible命令应用示例
ansible slave -m ping
ansible slave -m ping -u bruce --sudo
ansible slave -m ping -u bruce --sudo --sudo-user batman
ansible slave -m yum -a "name=vsftpd state=latest"
ansible slave -m yum -a ‘name=vsftpd state=present‘
ansible slave -m service -a ‘name=vsftpd state=started enabled=yes‘
ansible slave -m shell -a ‘ss -tln | grep 21‘
ansible slave -m shell -a "/tmp/test.sh"
ansible slave -m command -a ‘uptime‘
ansible slave -m user -a ‘name=hadoop comment="ansible add user" password="123123"‘
ansible slave -m copy -a ‘src=/root/.ssh/id_rsa.pub dest=/root‘
ansible slave -m shell -a ‘cat /root/id_rsa.pub >>/root/.ssh/authorized_keys‘
ansible slave -m service -a "name=httpd state=started"
ansible slave -m service -a "name=httpd state=restarted"
ansible slave -m service -a "name=httpd state=stopped"
标签:
原文地址:http://www.cnblogs.com/tangshengwei/p/5036341.html