@@ -123,8 +123,7 @@ resource "terraform_data" "execute_playbooks" {
123123 provisioner "remote-exec" {
124124 inline = [
125125 " if [ -f \" ~/.powervs/config.json\" ]; then echo ${ var . ansible_vault_password } > password_file" ,
126- " if [ -f \" ~/.powervs/config.json\" ]; then ansible-vault decrypt ~/.powervs/config.json --vault-password-file password_file" ,
127- " rm -f password_file"
126+ " if [ -f \" ~/.powervs/config.json\" ]; then ansible-vault decrypt ~/.powervs/config.json --vault-password-file password_file"
128127 ]
129128 }
130129
@@ -227,9 +226,7 @@ resource "terraform_data" "execute_playbooks_with_vault" {
227226 # Decrypt ocp config if it already exists
228227 provisioner "remote-exec" {
229228 inline = [
230- " if [ -f \" ~/.powervs/config.json\" ]; then echo ${ var . ansible_vault_password } > password_file" ,
231- " if [ -f \" ~/.powervs/config.json\" ]; then ansible-vault decrypt ~/.powervs/config.json --vault-password-file password_file" ,
232- " rm -f password_file"
229+ " if [ -f \" ~/.powervs/config.json\" ]; then ansible-vault decrypt ~/.powervs/config.json --vault-password-file password_file"
233230 ]
234231 }
235232
@@ -241,23 +238,24 @@ resource "terraform_data" "execute_playbooks_with_vault" {
241238 ]
242239 }
243240
244- # Again delete Ansible Vault password used to encrypt the var
245- # files with sensitive information and private ssh key
241+ # Encrypt ocp config if it already exists
246242 provisioner "remote-exec" {
247243 inline = [
248- " rm -rf password_file" ,
249- " rm -rf ${ local . private_key_file } "
244+ " if [ -f \" ~/.powervs/config.json\" ]; then echo ${ var . ansible_vault_password } > password_file" ,
245+ " if [ -f \" ~/.powervs/config.json\" ]; then ansible-vault encrypt ~/.powervs/config.json --vault-password-file password_file" ,
246+ " rm -f password_file"
250247 ]
251248 }
252249
253- # Encrypt ocp config if it already exists
250+ # Again delete Ansible Vault password used to encrypt the var
251+ # files with sensitive information and private ssh key
254252 provisioner "remote-exec" {
255253 inline = [
256- " if [ -f \" ~/.powervs/config.json\" ]; then echo ${ var . ansible_vault_password } > password_file" ,
257- " if [ -f \" ~/.powervs/config.json\" ]; then ansible-vault encrypt ~/.powervs/config.json --vault-password-file password_file" ,
258- " rm -f password_file"
254+ " rm -rf password_file" ,
255+ " rm -rf ${ local . private_key_file } "
259256 ]
260257 }
258+
261259}
262260
263261
0 commit comments