7a0a172880
The yaml file allows for installing murano-agent and chef and puppet by cloud-init Change-Id: Ia16270d67eeff50d41d8f879e7b4ad0a1037d4b1 Targets-blueprint: conf-lang-instance
92 lines
3.3 KiB
YAML
92 lines
3.3 KiB
YAML
Namespaces:
|
|
=: io.murano.resources
|
|
sys: io.murano.system
|
|
std: io.murano
|
|
|
|
Name: LinuxMuranoInstance
|
|
|
|
Extends:
|
|
- LinuxInstance
|
|
|
|
Methods:
|
|
prepareUserData:
|
|
Body:
|
|
- $userData: $.generateUserData()
|
|
- Return:
|
|
data: $._generateInstanceConfigResources($userData)
|
|
format: RAW
|
|
|
|
_generateInstanceConfigResources:
|
|
Arguments:
|
|
- userData:
|
|
Contract: $.string().notNull()
|
|
Body:
|
|
- $environment: $.find(std:Environment).require()
|
|
- $resources: new(sys:Resources)
|
|
- $muranoInitConf: $.generateCloudConfig()
|
|
- $bootScriptResourceName: format('boot_script_{0}', $.name)
|
|
- $userDataResourceName: format('user_data-{0}', $.name)
|
|
- $bootConfigResourceName: format('boot_config-{0}', $.name)
|
|
- $template:
|
|
resources:
|
|
$bootConfigResourceName:
|
|
type: 'OS::Heat::CloudConfig'
|
|
properties:
|
|
cloud_config: $muranoInitConf
|
|
$bootScriptResourceName:
|
|
type: 'OS::Heat::SoftwareConfig'
|
|
properties:
|
|
group: ungrouped
|
|
config: $userData
|
|
$userDataResourceName:
|
|
type: 'OS::Heat::MultipartMime'
|
|
properties:
|
|
parts:
|
|
- config: {get_resource: $bootConfigResourceName}
|
|
- config: {get_resource: $bootScriptResourceName}
|
|
|
|
- $environment.stack.updateTemplate($template)
|
|
- Return: {get_resource: $userDataResourceName}
|
|
|
|
|
|
generateCloudConfig:
|
|
Body:
|
|
- $resources: new(sys:Resources)
|
|
- $muranoInitConf: $resources.yaml('murano-init.conf')
|
|
- Return: $muranoInitConf
|
|
|
|
generateUserData:
|
|
Body:
|
|
- $environment: $.find(std:Environment).require()
|
|
- $resources: new(sys:Resources)
|
|
- $configFile: $resources.string('Agent-v2.template')
|
|
- $initScript: $resources.string('linux-init.sh')
|
|
- $muranoScript: $resources.string('murano-init.sh')
|
|
- $muranoAgentConf: $resources.string('murano-agent.conf')
|
|
- $muranoAgentService: $resources.string('murano-agent.service')
|
|
- $muranoAgent: $resources.string('murano-agent')
|
|
- $configReplacements:
|
|
"%RABBITMQ_HOST%": config(rabbitmq, host)
|
|
"%RABBITMQ_PORT%": config(rabbitmq, port)
|
|
"%RABBITMQ_USER%": config(rabbitmq, login)
|
|
"%RABBITMQ_PASSWORD%": config(rabbitmq, password)
|
|
"%RABBITMQ_VHOST%": config(rabbitmq, virtual_host)
|
|
"%RABBITMQ_SSL%": str(config(rabbitmq, 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), config(rabbitmq, host))
|
|
"%CA_ROOT_CERT_BASE64%": ""
|
|
- $muranoReplacements:
|
|
"%MURANO_AGENT_CONF%": base64encode($muranoAgentConf)
|
|
"%MURANO_AGENT_SERVICE%": base64encode($muranoAgentService)
|
|
"%MURANO_AGENT%": base64encode($muranoAgent)
|
|
|
|
- $userData: $muranoScript.replace($muranoReplacements) + $initScript.replace($scriptReplacements)
|
|
- Return: $userData
|
|
|
|
|
|
|