标签:连接 root 星期六 library sea 秘钥 figure com enter
cd ~/.ssh/
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
scp authorized_keys root@172.16.92.128:~/.ssh/
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh root@sjck-node01
Last login: Sat Mar 16 15:30:15 2019 from 172.16.92.1
sudo pip install ansible
Running setup.py install for ansible ... done
Successfully installed MarkupSafe-1.1.1 ansible-2.7.9 bcrypt-3.1.6 jinja2-2.10 paramiko-2.4.2 pyasn1-0.4.5 pynacl-1.3.0
ansible --version
ansible 2.7.9
config file = None
configured module search path = [u'/Users/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Python/2.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.10 (default, Oct 6 2017, 22:29:07) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
cat /etc/ansible/hosts
[spark]
sjck-node01 ansible_user=root
sjck-node02 ansible_user=root
sjck-node03 ansible_user=root
ansible spark -m ping
sjck-node02 | SUCCESS => {
"changed": false,
"ping": "pong"
}
sjck-node03 | SUCCESS => {
"changed": false,
"ping": "pong"
}
sjck-node01 | SUCCESS => {
"changed": false,
"ping": "pong"
}
ansible spark -m setup
关闭其中加一个节点,返回连接超时
ansible spark -m command -a 'date'
sjck-node02 | CHANGED | rc=0 >>
2019年 03月 16日 星期六 15:23:17 CST
sjck-node03 | CHANGED | rc=0 >>
2019年 03月 16日 星期六 15:23:17 CST
sjck-node01 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: ssh: connect to host sjck-node01 port 22: Operation timed out",
"unreachable": true
}
标签:连接 root 星期六 library sea 秘钥 figure com enter
原文地址:https://www.cnblogs.com/wanli002/p/10545752.html