mfq
mfq

Reputation: 1377

Pass input to terminal automatically?

I want to enter "yes" as a input when to "yes/no" automatically prompt on the screen instead of manually, here is the script

ansible-playbook -i hostvnc.ini vnc.yml --user=ubuntu --private-key=rampvnc.pem --extra-vars="dns=ec2-54-205-170-165.compute-1.amazonaws.com"

the dns option that I am passing on is actually generated dynamically. During the execution of this script here that very prompt

PLAY [vnc] ******************************************************************** 

GATHERING FACTS *************************************************************** 
The authenticity of host 'ec2-54-205-170-165.compute-1.amazonaws.com (54.205.170.165)' can't be established.
ECDSA key fingerprint is 31:7f:a1:f0:18:73:f1:6d:b9:dc:16:25:4a:4f:40:5f.
Are you sure you want to continue connecting (yes/no)? 

How can I enter "yes" as a input ?, I have tried this option but no success

ansible-playbook -i hostvnc.ini vnc.yml --user=ubuntu --private-key=rampvnc.pem --extra-vars="dns=ec2-54-205-170-165.compute-1.amazonaws.com" | echo "yes"

Upvotes: 2

Views: 1818

Answers (1)

Uku Loskit
Uku Loskit

Reputation: 42040

what about yes | your_command.

or better yet add this line to your ~/.ssh/config

StrictHostKeyChecking no

Upvotes: 5

Related Questions