http://sofar.blog.51cto.com/353572/1579894
first do password-free login, there are several machines on the SCP several times the public keySsh-keygen-T Rsa-p"'SCPId_rsa.pub192.168.2.84:/root/.SSH/Authorized_keys[[email protected]084-Monitor ansible]# bash Ansib[[email protected]084-monitor ansible]#CatAnsibwget--no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gzTarZXVF setuptools-7.0.Tar. GZCD Setuptools-7.0python setup.pyInstallCD../wget--no-check-certificate https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gzTarZXVF pycrypto-2.6.1.Tar. GZCD Pycrypto-2.6.1Yum Installpython-Develpython setup.pyInstallCD../wget--no-check-certificate http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gzTarZXVF yaml-0.1.5.Tar. GZCD Yaml-0.1.5./configure--prefix=/usr/Local Make--jobs= 'Cat/proc/cpuinfo|grepprocessor|WC-l ' CD./wget--no-check-certificate https://pypi.python.org/packages/source/p/pyyaml/pyyaml-3.11.tar.gzTarZXVF pyyaml-3.11.Tar. GZCD Pyyaml-3.11python setup.pyInstallCD../wget--no-check-certificate https://pypi.python.org/packages/source/m/markupsafe/markupsafe-0.9.3.tar.gzTarZXVF markupsafe-0.9.3.Tar. GZCD Markupsafe-0.9.3python setup.pyInstallCD../wget--no-check-certificate https://pypi.python.org/packages/source/j/jinja2/jinja2-2.7.3.tar.gzTarZXVF jinja2-2.7.3.Tar. GZCD Jinja2-2.7.3python setup.pyInstallCD../wget--no-check-certificate https://pypi.python.org/packages/source/e/ecdsa/ecdsa-0.11.tar.gzTarZXVF ecdsa-0.11.Tar. GZCD ECDSA-0.11python setup.pyInstallCD../wget--no-check-certificate https://pypi.python.org/packages/source/p/paramiko/paramiko-1.15.1.tar.gzTarZXVF paramiko-1.15.1.Tar. GZCD Paramiko-1.15.1python setup.pyInstallCD../wget--no-check-certificate https://pypi.python.org/packages/source/s/simplejson/simplejson-3.6.5.tar.gzTarZXVF simplejson-3.6.5.Tar. GZCD Simplejson-3.6.5python setup.pyInstallCD../wget--no-check-certificate https://github.com/ansible/ansible/archive/v1.7.2.tar.gzTarZXVF v1.7.2.Tar. GZCD ansible-1.7.2/python setup.pyInstallCD../mkdir-p/etc/ansibleCat<<eof >/etc/ansible/Ansible.cfg[defaults]hostfile=/etc/ansible/hostseofCat<<eof >/etc/ansible/Hosts[aa]192.168.2.220192.168.2.221192.168.2.222192.168.2.223192.168.2.224Eof[[email protected]084-monitor ansible]# ansible aa-m command-a' Free'192.168.2.224| Success | Rc=0>>Total used Freeshared buffers Cachedmem:1020132 953112 67020 0 134156 541024-/+ Buffers/cache:277932 742200Swap:1675256 6260 1668996192.168.2.223| Success | Rc=0>>Total used Freeshared buffers Cachedmem:7999632 7717876 281756 0 219012 6540924-/+ Buffers/cache:957940 7041692Swap:3145720 32772 3112948192.168.2.220| Success | Rc=0>>Total used Freeshared buffers Cachedmem:3923760 3818168 105592 0 239264 2671504-/+ Buffers/cache:907400 3016360Swap:3145720 132888 3012832192.168.2.221| Success | Rc=0>>Total used Freeshared buffers Cachedmem:1019820 723684 296136 0 138636 104360-/+ Buffers/cache:480688 539132Swap:1675256 736 1674520192.168.2.222| Success | Rc=0>>Total used Freeshared buffers Cachedmem:1020296 951344 68952 0 69916 218880-/+ Buffers/cache:662548 357748Swap:1675256 161188 1514068
Ansible of Linux Services