From 68e8325638bbf5d8846df7882b456963dfa803de Mon Sep 17 00:00:00 2001 From: Sean Cavanaugh Date: Tue, 15 Dec 2020 10:32:52 -0500 Subject: [PATCH] fix issue when there is no credentials applied will need to add more dummy for aws and gcp when we add more public cloud demos --- .../tasks/{azure_cred.yml => azure.yml} | 9 ++------- roles/install_demo/tasks/main.yml | 9 +++++---- roles/install_demo/tasks/unsupported_cloud.yml | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 11 deletions(-) rename roles/install_demo/tasks/{azure_cred.yml => azure.yml} (86%) create mode 100644 roles/install_demo/tasks/unsupported_cloud.yml diff --git a/roles/install_demo/tasks/azure_cred.yml b/roles/install_demo/tasks/azure.yml similarity index 86% rename from roles/install_demo/tasks/azure_cred.yml rename to roles/install_demo/tasks/azure.yml index defc986..bc4ec57 100644 --- a/roles/install_demo/tasks/azure_cred.yml +++ b/roles/install_demo/tasks/azure.yml @@ -2,7 +2,7 @@ - name: add azure credential tower_credential: name: azure_credential - description: Azure Service Principle + description: Azure Service Principle organization: "{{ vars[demo].project.organization }}" state: present kind: azure_rm @@ -13,9 +13,4 @@ tower_username: "{{ my_tower_username }}" tower_password: "{{ my_tower_password }}" tower_host: "{{ my_tower_host }}" - - - - - - + validate_certs: false diff --git a/roles/install_demo/tasks/main.yml b/roles/install_demo/tasks/main.yml index ca57ca1..2663f86 100644 --- a/roles/install_demo/tasks/main.yml +++ b/roles/install_demo/tasks/main.yml @@ -20,10 +20,11 @@ - "demo must be defined and be one of: {{ demo_list }}" - "full list can be found on https://github.com/ansible/product-demos" -# - name: install Azure cred -# include_tasks: azure_cred.yml -# when: -# - azure_demo == True +- name: setup public cloud credentials + include_tasks: "{{item}}" + with_first_found: + - "{{role_path}}/tasks/{{public_cloud}}.yml" + - "{{role_path}}/tasks/unsupported_cloud.yml" - name: install all job templates include_tasks: job_template_loop.yml diff --git a/roles/install_demo/tasks/unsupported_cloud.yml b/roles/install_demo/tasks/unsupported_cloud.yml new file mode 100644 index 0000000..383b0a7 --- /dev/null +++ b/roles/install_demo/tasks/unsupported_cloud.yml @@ -0,0 +1,16 @@ +- name: public cloud not supported + debug: + msg: "there is no public cloud credentials for this install, installing dummy creds" + +- name: add azure credential + tower_credential: + name: azure_credential + description: Azure Service Principle + organization: "{{ vars[demo].project.organization }}" + state: present + kind: azure_rm + subscription: "please replace me" + tower_username: "{{ my_tower_username }}" + tower_password: "{{ my_tower_password }}" + tower_host: "{{ my_tower_host }}" + validate_certs: false