deb-murano/meta/io.murano/Classes/resources/WindowsInstance.yaml
Stan Lagun 322ba88742 Added property to associate environment with OS region
The Environment class got two additional properties:

region - name of the region where environment should be deployed. If
null then home region is used.

regionConfigs - config property (taken from class config) that specifies
region parameters. It is a dictionary of a form regionName -> regionSettings.
Currently the only setting available is a agentRabbitMq that is itself
a dictionary containing the same options as [rabbitmq] section of murano.conf

Thus the configuration file io.murano.Environment.yaml may look like:

 regionConfigs:
   RegionOne:
     agentRabbitMq:
       host: rabbitMqHostName
       port: 5672
       login: murano
       password: murano
       virtual_host: /
       ssl: false
       ca_certs: null

Implements Blueprint: assign-environment-to-region
Change-Id: I3c84c96f8eeae738f83ed7b3691be38100b30e1d
2016-03-03 18:25:47 +03:00

61 lines
2.3 KiB
YAML

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
Namespaces:
=: io.murano.resources
std: io.murano
sys: io.murano.system
Name: WindowsInstance
Extends: Instance
Methods:
createDefaultInstanceSecurityGroupRules:
Arguments:
- groupName:
Contract: $.string().notNull()
Body:
- $environment: $.find(std:Environment).require()
- $rules:
- ToPort: 3389
IpProtocol: tcp
FromPort: 3389
External: true
- $environment.securityGroupManager.addGroupIngress(
rules => $rules, groupName => $groupName)
prepareUserData:
Body:
- $resources: new(sys:Resources)
- $environment: $.find(std:Environment).require()
- $rabbitMqParams: $environment.regionConfigs.get($environment.region).agentRabbitMq
- $configFile: $resources.string('Agent-v1.template')
- $initScript: $resources.string('windows-init.ps1')
- $configReplacements:
"%RABBITMQ_HOST%": $rabbitMqParams.host
"%RABBITMQ_PORT%": $rabbitMqParams.port
"%RABBITMQ_USER%": $rabbitMqParams.login
"%RABBITMQ_PASSWORD%": $rabbitMqParams.password
"%RABBITMQ_VHOST%": $rabbitMqParams.virtual_host
"%RABBITMQ_SSL%": str($rabbitMqParams.ssl).toLower()
"%RABBITMQ_INPUT_QUEUE%": $.agent.queueName()
"%RESULT_QUEUE%": $environment.agentListener.queueName()
- $scriptReplacements:
"%AGENT_CONFIG_BASE64%": base64encode($configFile.replace($configReplacements))
"%INTERNAL_HOSTNAME%": $.name
"%MURANO_SERVER_ADDRESS%": coalesce(config(file_server), $rabbitMqParams.host)
"%CA_ROOT_CERT_BASE64%": ""
- Return:
data: $initScript.replace($scriptReplacements)
format: HEAT_CFNTOOLS