-
Notifications
You must be signed in to change notification settings - Fork 30
/
openstack-windows-winrm-blueprint.yaml
113 lines (104 loc) · 3.91 KB
/
openstack-windows-winrm-blueprint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
tosca_definitions_version: cloudify_dsl_1_4
description: >
The blueprint describes an OpenStack Windows vm created using Cloudify's OpenStack plugin
and simple web server started using winrm.
In addition, an OpenStack floating ip and security group are created and associated with the created vm.
imports:
- http://www.getcloudify.org/spec/cloudify/7.1.0.dev1/types.yaml
- plugin:cloudify-openstack-plugin
inputs:
webserver_port:
description: The HTTP web server port
default: 8080
agent_user:
description: User name used to remotely conntect to the machine via WinRM
image:
description: Openstack image name or id to use for the new server
flavor:
description: Openstack flavor name or id to use for the new server
network_name:
description: Openstack network name the new server will be connected to
floating_network_id:
description: The id of the network to use for allocating a floating ip
key_pair_name:
description: Openstack key pair name of the key to associate with the new server
private_key_path:
description: |
Path to the private key which will be used for decrypting the VMs password
generated by OpenStack.
node_templates:
virtual_ip:
type: cloudify.openstack.nodes.FloatingIP
properties:
floatingip:
floating_network_id: { get_input: floating_network_id }
security_group:
type: cloudify.openstack.nodes.SecurityGroup
properties:
rules:
- remote_ip_prefix: 0.0.0.0/0
port: { get_property: [ http_web_server, port ] }
- remote_ip_prefix: 0.0.0.0/0
port: 5985
keypair:
type: cloudify.openstack.nodes.KeyPair
properties:
use_external_resource: true
resource_id: { get_input: key_pair_name }
private_key_path: { get_input: private_key_path }
vm:
type: cloudify.openstack.nodes.WindowsServer
properties:
agent_config:
user: { get_input: agent_user }
image: { get_input: image }
flavor: { get_input: flavor }
management_network_name: { get_input: network_name }
server:
userdata: |
#ps1_sysnative
winrm quickconfig -q
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
&netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow
&netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow
relationships:
- type: cloudify.openstack.server_connected_to_keypair
target: keypair
- type: cloudify.openstack.server_connected_to_floating_ip
target: virtual_ip
- type: cloudify.openstack.server_connected_to_security_group
target: security_group
interfaces:
cloudify.interfaces.validation: {}
http_web_server:
type: cloudify.nodes.WebServer
properties:
port: { get_input: webserver_port }
relationships:
- type: cloudify.relationships.contained_in
target: vm
interfaces:
cloudify.interfaces.lifecycle:
configure:
implementation: scripts/powershell/configure.ps1
inputs:
process:
command_prefix: powershell
start:
implementation: scripts/powershell/start.ps1
inputs:
process:
command_prefix: powershell
stop:
implementation: scripts/powershell/stop.ps1
inputs:
process:
command_prefix: powershell
outputs:
http_endpoint:
description: Web server external endpoint
value: { concat: ['http://', { get_attribute: [virtual_ip, floating_ip_address] },
':', { get_property: [http_web_server, port] }] }