diff --git a/data/demo_init.sh b/data/demo_init.sh new file mode 100644 index 0000000..09024cb --- /dev/null +++ b/data/demo_init.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +AgentConfigBase64='%AGENT_CONFIG_BASE64%' + +mkdir /etc/murano + +echo AgentConfigBase64 | base64 -d > /etc/murano/agent.config \ No newline at end of file diff --git a/data/init.ps1 b/data/init.ps1 index b522123..c14b565 100644 --- a/data/init.ps1 +++ b/data/init.ps1 @@ -1,6 +1,6 @@ #ps1 -$WindowsAgentConfigBase64 = '%WINDOWS_AGENT_CONFIG_BASE64%' +$WindowsAgentConfigBase64 = '%AGENT_CONFIG_BASE64%' $WindowsAgentConfigFile = "C:\Murano\Agent\WindowsAgent.exe.config" $WindowsAgentLogFile = "C:\Murano\Agent\log.txt" diff --git a/data/templates/agent-config/Demo.template b/data/templates/agent-config/Demo.template new file mode 100644 index 0000000..8fec1df --- /dev/null +++ b/data/templates/agent-config/Demo.template @@ -0,0 +1,8 @@ +RABBITMQ_HOST = "%RABBITMQ_HOST%" +RABBITMQ_PORT = "%RABBITMQ_PORT%" +RABBITMQ_USERNAME = "%RABBITMQ_USER%" +RABBITMQ_PASSWORD = "%RABBITMQ_PASSWORD%" +RABBITMQ_VHOST = "%RABBITMQ_VHOST%" +RABBITMQ_INPUT_QUEUE = "%RABBITMQ_INPUT_QUEUE%" +RESULT_QUEUE = "%RESULT_QUEUE%" +RABBITMQ_RESULT_ROUTING_KEY = "%RESULT_QUEUE%" diff --git a/data/templates/agent/Demo.template b/data/templates/agent/Demo.template new file mode 100644 index 0000000..3a41aec --- /dev/null +++ b/data/templates/agent/Demo.template @@ -0,0 +1,7 @@ +{ + "Scripts": [ + ], + "Commands": [ + ], + "RebootOnCompletion": 0 +} diff --git a/data/templates/cf/Demo.template b/data/templates/cf/Demo.template new file mode 100644 index 0000000..2dae23b --- /dev/null +++ b/data/templates/cf/Demo.template @@ -0,0 +1,26 @@ +{ + "AWSTemplateFormatVersion" : "2010-09-09", + + "Parameters" : { + "KeyName" : { + "Description" : "Key Pair name for Load Balancer", + "Type" : "String", + "Default" : "murano-lb-key" + } + }, + + "Resources" : { + "$instanceName": { + "Type" : "AWS::EC2::Instance", + "Properties": { + "InstanceType" : "$instanceType", + "ImageId" :"$imageName", + "AvailabilityZone" : "$availabilityZone", + "UserData": "$userData" + } + } + }, + + "Outputs" : { + } +} diff --git a/data/workflows/Demo.xml b/data/workflows/Demo.xml new file mode 100644 index 0000000..cfe61f6 --- /dev/null +++ b/data/workflows/Demo.xml @@ -0,0 +1,76 @@ + + + + + + + ( + + + + + + + + + + Instance ) created! + + + + + ( + + + + + + + + + + ( + + + + Demo service ) has started + + + + + ( + + + + + + + diff --git a/muranoconductor/cloud_formation.py b/muranoconductor/cloud_formation.py index 52c4b23..043cfeb 100644 --- a/muranoconductor/cloud_formation.py +++ b/muranoconductor/cloud_formation.py @@ -76,10 +76,10 @@ def delete_cf_stack(engine, context, body, **kwargs): def prepare_user_data(context, hostname, service, unit, - template='Default', **kwargs): + template='Default', initFile='init.ps1', **kwargs): settings = config.CONF.rabbitmq - with open('data/init.ps1') as init_script_file: + with open('data/{0}'.format(initFile)) as init_script_file: with open('data/templates/agent-config/{0}.template'.format( template)) as template_file: init_script = init_script_file.read() @@ -102,7 +102,7 @@ def prepare_user_data(context, hostname, service, unit, template_data = set_config_params(template_data, replacements) init_script = init_script.replace( - '%WINDOWS_AGENT_CONFIG_BASE64%', + '%AGENT_CONFIG_BASE64%', base64.b64encode(template_data)) init_script = init_script.replace('%INTERNAL_HOSTNAME%', hostname)