From ed71ae7e7cc94bc2134af1aa8f5759d63ef3bcc0 Mon Sep 17 00:00:00 2001 From: pkomarov Date: Mon, 26 Feb 2018 13:18:51 +0200 Subject: [PATCH] This section creates the clouds.yaml file from undercloud/overcloud credentials . This is for use by pythonsdk api for OSP connection and querrying. This will allow us to run the same rally/sts tests on the OSP deployment whether it was deployed by Infrared or Quickstart. Change-Id: I82e3fd04282506f706f91bfd399795f92612cf36 --- infrared/infrared_instance-ha_plugin_main.yml | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/infrared/infrared_instance-ha_plugin_main.yml b/infrared/infrared_instance-ha_plugin_main.yml index 6b641d8..437c365 100644 --- a/infrared/infrared_instance-ha_plugin_main.yml +++ b/infrared/infrared_instance-ha_plugin_main.yml @@ -24,8 +24,59 @@ # - include_role: # name: instance-ha -#This executes all from the undercloud itself: +#This creates the clouds.yaml file from undercloud/overcloud credentials +#for use in pythonsdk api for osp connection and querrying: +- name: create clouds.yaml for pythonsdk api + hosts: undercloud + tasks: + + - name: get undercloud variables + shell: | + for key in $( set | awk '{FS="="} /^OS_/ {print $1}' ); do unset $key ; done + source /home/stack/stackrc + echo -n "undercloud: {'auth': { 'auth-url': '$OS_AUTH_URL', 'username': '$OS_USERNAME', 'password': '$OS_PASSWORD', 'project-name': '${OS_PROJECT_NAME:-$OS_TENANT_NAME}' }}" + register: cloud_details + + - name: create clouds.yaml if doesn't exist + blockinfile: + content: 'clouds:' + dest: " /home/stack/clouds.yaml" + marker: "#{mark} HEADER" + create: yes + + - name: insert undercloud parameters + blockinfile: + dest: " /home/stack/clouds.yaml" + block: |5 + {{ cloud_details.stdout|from_yaml|to_nice_yaml(indent=4) }} + insertbefore: "#END undercloud SECTION" + marker: "#{mark} undercloud PARAMETERS" + + - name: get overcloud variables + shell: | + for key in $( set | awk '{FS="="} /^OS_/ {print $1}' ); do unset $key ; done + source /home/stack/overcloudrc + echo -n "overcloud: {'auth': { 'auth-url': '$OS_AUTH_URL', 'username': '$OS_USERNAME', 'password': '$OS_PASSWORD', 'project-name': '${OS_PROJECT_NAME:-$OS_TENANT_NAME}' }}" + register: cloud_details + + - name: create clouds.yaml if doesn't exist + blockinfile: + content: 'clouds:' + dest: " /home/stack/clouds.yaml" + marker: "#{mark} HEADER" + create: yes + + - name: insert overcloud parameters + blockinfile: + dest: " /home/stack/clouds.yaml" + block: |5 + {{ cloud_details.stdout|from_yaml|to_nice_yaml(indent=4) }} + insertbefore: "#END overcloud SECTION" + marker: "#{mark} overcloud PARAMETERS" + + +#This executes all from the undercloud itself: - name: Configure Instance HA hosts: undercloud