How to run an ansible-playbook with a passphrase-protected-ssh-private-key?

后端 未结 3 1329
花落未央
花落未央 2021-01-30 22:26

I have an autoscaling group on Amazon EC2 and I have added my public key when I create AMI with packer so I can run ansible-playbook and ssh to the hos

3条回答
  •  梦毁少年i
    2021-01-30 23:15

    In ansible There is no option to store passphrase-protected private key

    For that we need to add the passphrase-protected private key in the ssh-agent

    Start the ssh-agent in the background.

    # eval "$(ssh-agent -s)"
    

    Add SSH private key to the ssh-agent

    # ssh-add ~/.ssh/id_rsa
    

    Now try running ansible-playbook and ssh to the hosts.

提交回复
热议问题