Home  >  Article  >  Computer Tutorials  >  Ansible way to connect to the controlled terminal

Ansible way to connect to the controlled terminal

WBOY
WBOYforward
2024-02-18 16:51:291028browse

ssh key

# 生成秘钥
ssh-keygen
# 将秘钥拷贝到被管理服务器上
ssh-copy-id-i ~/.ssh/id_rsa.pub -p 22 root@192.168.182.130

account password

1. Command line configuration

# -k:交互式
ansible -uroot -k 192.168.182.130 -m ping

2. Configure in the configuration file

# 默认主机配置文件:/etc/ansible/hosts
192.168.182.130 ansible_ssh_user=root ansible_ssh_pass=123456

[web]
192.168.182.130 ansible_ssh_user=root ansible_ssh_pass=123456

Commonly used configuration parameters are as follows:

Ansible way to connect to the controlled terminal

The above is the detailed content of Ansible way to connect to the controlled terminal. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:mryunwei.com. If there is any infringement, please contact admin@php.cn delete