Reputation: 1704
I've been trying to automatically decrypt encrypted Ansible yaml files. I know you can just set the ansible.cfg with
But well, I was curious. Turns out I'm unable to do a simple task. Here is the dumb script
#!/usr/bin/expect
set timeout 9
set file [lindex $argv 0]
spawn ansible-vault decrypt $file
expect "Vault password:"
send "MyAwesomePassword\r"
Then I use the script as
ansible-vault decrypt vars-mysql-config.yml
Output is
spawn ansible-vault decrypt /Users/ruben/ansible/vars/vars-mysql-config.yml
Vault password: %
No success. I know this is a stupid question but is so simple and I feel so stuck that I thought I forgot something.
Any ideas? thanks for reading!
Upvotes: 0
Views: 209
Reputation: 2172
Try this:
#!/usr/bin/expect
set timeout 9
set file [lindex $argv 0]
spawn ansible-vault decrypt $file
expect "Vault password: "
send "MyAwesomePassword\r"
interact
I have added a space in expect command and added interact command in end.
Upvotes: 1