标签:root jmx shell serve user 内容 获取 http art
一、添加ansible主机# vim /etc/ansible/hosts
[server1]
添加以下内容:
192.168.61.130 ansible_ssh_port=22 ansible_ssh_user=root ansible_ssh_pass=redhat
192.168.61.131 ansible_ssh_port=22 ansible_ssh_user=root ansible_ssh_pass=redhat
# ansible-doc -l
Ansible默认模块,执行远程主机上的shell命令
# ansible server1 -m command -a "df -h"
在远程主机上执行主控端上的脚本
# ansible server1 -m script -a "/wh_k/test.sh"
在远程主机上执行远程主机的脚本
# ansible server1 -m command -a "ls -l /wh_k/test.sh"
# ansible server1 -m command -a "chmod 751 /wh_k/test.sh"
# ansible server -m shell -a "/wh_k/test.sh"
向远程主机拷贝文件
# ansible server1 -m copy -a "src=/wh_k/jmxcmd.jar dest=/wh_k/"
获取远程主机文件的状态ctime、mtime等
# ansible server1 -m stat -a ‘path=/wh_k/test.sh‘
远程主机软件包管理操作,yum、apt等
# ansible server1 -m yum -a ‘name=httpd state=latest‘
远程主机系统服务管理
# ansible server1 -m service -a ‘name=httpd state=start‘
远程主机用户
# ansible server1 -m user -a "name=wangwang"
标签:root jmx shell serve user 内容 获取 http art
原文地址:http://blog.51cto.com/13689359/2332346