File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
solutions/standard-openshift/ansible Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -122,8 +122,12 @@ resource "terraform_data" "execute_playbooks" {
122122 # Decrypt ocp config if it already exists
123123 provisioner "remote-exec" {
124124 inline = [
125- " if [ -f \" /root/.powervs/config.json\" ]; then echo ${ var . ansible_vault_password } > password_file; fi" ,
126- " if [ -f \" /root/.powervs/config.json\" ]; then ansible-vault decrypt /root/.powervs/config.json --vault-password-file password_file; fi"
125+ " if [ -f \" /root/.powervs/config.json\" ]; then" ,
126+ " if ! ( head -n 1 | grep -q '^\\ $ANSIBLE_VAULT' ); then" ,
127+ " echo ${ var . ansible_vault_password } > password_file" ,
128+ " ansible-vault decrypt /root/.powervs/config.json --vault-password-file password_file" ,
129+ " fi" ,
130+ " fi"
127131 ]
128132 }
129133
@@ -230,7 +234,11 @@ resource "terraform_data" "execute_playbooks_with_vault" {
230234 # Decrypt ocp config if it already exists
231235 provisioner "remote-exec" {
232236 inline = [
233- " if [ -f \" /root/.powervs/config.json\" ]; then ansible-vault decrypt /root/.powervs/config.json --vault-password-file password_file; fi"
237+ " if [ -f \" /root/.powervs/config.json\" ]; then" ,
238+ " if ! ( head -n 1 | grep -q '^\\ $ANSIBLE_VAULT' ); then" ,
239+ " ansible-vault decrypt /root/.powervs/config.json --vault-password-file password_file" ,
240+ " fi" ,
241+ " fi"
234242 ]
235243 }
236244
You can’t perform that action at this time.
0 commit comments