Is there any way to encrypt --private-key with ansible-vault and use it encrypted with Ansible Playbook

0 votes

Is there any way to encrypt --private-key with ansible-vault, encrypt it and use it with Ansible Playbook.

Jan 29 in Ansible by Kajol
197 views

1 answer to this question.

0 votes

Hey @Kajol,

Create a passphrase for the key

openssl rsa -in ssh_key.pem -out encrypted_ssh_key.pem

Give it a passphrase and provide that passphrase every time you run it, like thos:

ansible-playbook ansible_playbook -i inventory/ec2.py \
    -e ansible_ssh_user=ubuntu \
    -e ansible_user=ubuntu \
    --private-key=encrypted_ssh_key.pem
answered Jan 29 by Anupam

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer

Is it possible to run a playbook with a crontab?

Ofcourse you can run ansible playbook with ...READ MORE

answered Jan 17 in Ansible by Yesha
182 views
0 votes
1 answer

How to encrypt and existing file using Ansible Vault?

Hey @Kyraa, to encrypt an existing file ...READ MORE

answered Jan 29 in Ansible by Kavya
238 views
0 votes
1 answer

Running ansible command on a single server when it is deployed to multiple servers

You can try the run_once attribute: Example from ...READ MORE

answered Jun 13, 2018 in Ansible by DareDev
• 6,810 points
123 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Is it possible to run an Ansible Playbook in python script?

Hey @Cerci, Of course its possible. You ...READ MORE

answered Jan 17 in Ansible by Nicolas
1,228 views
0 votes
1 answer