Skip to content

Commit

Permalink
fix: _dependencies/main.yml incorrest stat var; ability to use dict i…
Browse files Browse the repository at this point in the history
…n gcp_service_account_rawtext (#84)

Co-authored-by: Mike Krasnianskyi <[email protected]>
  • Loading branch information
mikekrasn and Mike Krasnianskyi authored Mar 10, 2021
1 parent 575a397 commit 054e317
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _dependencies/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
block:
- name: "set gcp_credentials_file fact"
set_fact:
gcp_credentials_file: "gcp__{{ (cluster_vars[buildenv].gcp_service_account_rawtext | string | from_json).project_id }}.json"
gcp_credentials_file: "gcp__{{ (cluster_vars[buildenv].gcp_service_account_rawtext if cluster_vars[buildenv].gcp_service_account_rawtext|type_debug == 'dict' else cluster_vars[buildenv].gcp_service_account_rawtext | string | from_json).project_id }}.json"
when: gcp_credentials_file is not defined

- name: dynamic_inventory | stat the gcp_credentials_file
Expand All @@ -66,5 +66,5 @@

- name: "Copy credentials into gcp_credentials_file as {{gcp_credentials_file}}"
local_action: copy content={{cluster_vars[buildenv].gcp_service_account_rawtext}} dest={{gcp_credentials_file}}
when: not (stat_inventory_file.stat is defined and stat_inventory_file.stat.exists|bool == false )
when: not r__stat_gcp_credentials_file.stat.exists|default(False)|bool
when: cluster_vars.type == "gcp"

0 comments on commit 054e317

Please sign in to comment.