ansible ssh prompt known_hosts issue

前端 未结 7 1259
甜味超标
甜味超标 2020-12-23 16:25

I\'m running Ansible playbook and it works fine on one machine.

On a new machine when I try for the first time, I get the following error.

17:04:34          


        
7条回答
  •  孤城傲影
    2020-12-23 17:08

    I've created this shell script (also works from Jenkins, btw)

    my_known_hosts="$HOME/.ssh/known_hosts"
    ## housekeeping ##
    if [ -f $my_known_hosts".old" ] 
        then rm -f $my_known_hosts".old"
    fi
    ## housekeeping ##
    ## backup ##
    if [ -f $my_known_hosts ] 
        then mv $my_known_hosts "$my_known_hosts.old"
    fi
    ## backup ##
    ## query aws for active hosts and add to known_hosts
    aws ec2 describe-instances --query 'Reservations[*].Instances[*].NetworkInterfaces[*].Association.PublicDnsName' --output text | xargs -L1 ssh-keyscan -H >> $my_known_hosts
    ## query aws for active hosts and add to known_hosts
    

    https://admin-o-mat.blogspot.com/2020/09/ansible-and-aws-adding-hosts-to.html

提交回复
热议问题