From fc30066a35dc38fb01e162ae78fe97beab228e72 Mon Sep 17 00:00:00 2001
From: Jill Rouleau <jill.rouleau@bespokess.com>
Date: Fri, 24 Aug 2018 11:42:08 -0700
Subject: [PATCH] Add stack output ansible_group_vars

This change adds a stack output to services/common.yaml that acts
as an interface for Ansible group variables.  Ansible vars provided
via this interface will be consumed by config-download and written
under $config-download-dir/group_vars/ where they can be accessed
by ansible commands.

Part of blueprint ansible-tasks-to-role.

Change-Id: Ib70e7dda13b4a3ed30af88906ba42c25cdc93038
---
 common/services.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/common/services.yaml b/common/services.yaml
index bc861814f1..558e2b32b2 100644
--- a/common/services.yaml
+++ b/common/services.yaml
@@ -329,6 +329,17 @@ resources:
           expression: coalesce($.data, []).where($ != null).select($.get('host_prep_tasks')).where($ != null).flatten().distinct()
           data: {get_attr: [ServiceChain, role_data]}
 
+  AnsibleGroupVars:
+    type: OS::Heat::Value
+    properties:
+      type: json
+      value:
+        map_merge:
+          yaql:
+            expression: list(coalesce($.data.role_data, []).where($ != null).select($.get('ansible_group_vars')).where($ != null))
+            data: {role_data: {get_attr: [ServiceChain, role_data]}}
+
+
 outputs:
   role_data:
     description: Combined Role data for this set of services.
@@ -357,6 +368,7 @@ outputs:
       post_update_tasks: {get_attr: [PostUpdateTasks, value]}
       upgrade_batch_tasks: {get_attr: [UpgradeBatchTasks, value]}
       service_metadata_settings: {get_attr: [ServiceServerMetadataHook, metadata]}
+      ansible_group_vars: {get_attr: [AnsibleGroupVars, value]}
 
       # Keys to support docker/services
       puppet_config: {get_attr: [PuppetConfig, value]}