我使用 Powershell 命令创建了 Heat 模板,并且在添加部署部分后我的模板没有被执行。我已添加此部分以获取命令的输出。下面显示了我正在使用的模板:
heat_template_version: 2016-10-14
description: Template to install HyperV Feature in Server
resources:
floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: Net_External_16
instance:
type: OS::Nova::Server
properties:
name: machine2
flavor: LARGE
networks:
- network: 71xxxx85-8a24-475b-9xxc-169xxxxxbb0
security_groups:
- default
- all_open
block_device_mapping_v2:
- device_name: /dev/vpa
volume_id: {get_resource: volume}
delete_on_termination: "true"
volume:
type: OS::Cinder::Volume
properties:
size: 25
image: 51xxxxxbe-44e6-4206-920c-xxxxxxxxxx
name: {get_param: volumename}
ps_script:
type: OS::Heat::SoftwareConfig
properties:
group: ungrouped
config:
str_replace:
template: |
#ps1_sysnative
$log = New-Item "C:\check_file.txt" -Type File
start-sleep -s 20
install-windowsfeature -Name DNS -IncludeManagementTools
start-sleep -s 60
$pass = "_parameter_1_"
Add-content $log $pass
params:
_parameter_1_: {get_param: parameter1}
association:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip}
port_id: {get_attr: [instance, addresses, 71xxxxx85-8a24-4xxb-9xxc-16xxxx84bb0, 0, port]}
deployment:
type: OS::Heat::SoftwareDeployment
properties:
config: {get_resource: ps_script}
server: {get_resource: instance }
outputs:
instance_ip:
description: Ipaddress
value: {get_attr: [instance,addresses]}
result:
description: Checkoutput
value: {get_attr: [deployent]}
如果有人尝试过相同的方法或他们可以提供的任何其他解决方案来获取从模板执行的 powershell 命令的输出。