Ansible with multiple SSH key pair

前端 未结 2 1310
天涯浪人
天涯浪人 2021-02-02 07:03

I am new to Ansible. I am able to test it and its working fine with my test requirment. For making connection between management node and the client node I am using already crea

2条回答
  •  被撕碎了的回忆
    2021-02-02 07:45

    Good news- in a basic use case, this is fairly easy. Simply use the ansible_ssh_private_key_file parameter in your Ansible inventory.

    Here are some examples purloined from my personal file:

    $ cat hosts.ini
    
    [server1]
    54.1.2.3 ansible_ssh_private_key_file=~/.ssh/server1.pem
    
    [testservers]
    ec2-54-2-3-4.compute-1.amazonaws.com ansible_ssh_private_key_file=~/.ssh/aws-testserver.pem ansible_ssh_user=ubuntu
    ec2-54-2-3-5.compute-1.amazonaws.com ansible_ssh_private_key_file=~/.ssh/aws-testserver.pem ansible_ssh_user=ubuntu
    
    [piwall]
    10.0.0.88 ansible_ssh_private_key_file=~/.ssh/raspberrypi.pem ansible_ssh_user=pi
    

提交回复
热议问题