01.Ansible基本使用(ad-hoc)

1.1 SSH密码认证

[webservers]
192.168.56.66:22 ansible_ssh_user=root ansible_ssh_pass=1
192.168.56.65:22 ansible_ssh_user=root ansible_ssh_pass=1

1.2 SSH密钥对认证

[webservers]
192.168.1.10:22 ansible_ssh_user=root ansible_ssh_key=/root/.ssh/id_rsa
192.168.1.11:22 ansible_ssh_user=root

1.3 基本命令

[root@k8s-node2 ~]# ansible webservers --list
  hosts (2):
    192.168.56.65
    192.168.56.66

__END__