første xml update
[virt-orchestrator.git] / vFLOWER / content / Workflows / uio / lib / tools / exec_post_scipts.workflow.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <workflow xmlns="http://vmware.com/vco/workflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://vmware.com/vco/workflow http://vmware.com/vco/workflow/Workflow-v4.xsd" root-name="item33" object-name="workflow:name=generic" id="8986a211-6aae-404a-8586-374d658fbee8" version="1.0.34" api-version="3.1.0" allowed-operations="fve" restartMode="1" resumeFromFailedMode="0">
3     <display-name>exec_post_scipts</display-name>
4
5     <description>Execute post scipts to build a UiO windows server</description>
6
7     <position x="305.0" y="9.045454545454543"/>
8
9     <input>
10         <param name="vm" type="VC:VirtualMachine">
11             <description>Virtual machine</description>
12         </param>
13         <param name="windows_roles" type="Array/string">
14             <description>Windows roles. Other workflow fetches roles from database</description>
15         </param>
16         <param name="vlan_name" type="string">
17             <description>Vlan descriptive name</description>
18         </param>
19         <param name="ad_domain_id" type="number">
20             <description>Domain id from database. if &gt; 0 add to AD</description>
21         </param>
22         <param name="ad_domain_name" type="string">
23             <description>Domene navn</description>
24         </param>
25         <param name="ipv6address" type="string">
26             <description>ipv6 ipaddresse</description>
27         </param>
28         <param name="ipv6Prefixlen" type="number">
29             <description>ipv6 Netmaske</description>
30         </param>
31         <param name="ipv6gateway" type="string">
32             <description>ipv6 gateway</description>
33         </param>
34         <param name="ipv6dnsServerList" type="Array/string">
35             <description>ipv6 dns server liste</description>
36         </param>
37         <param name="vmPassword" type="SecureString">
38             <description>Password for the virtual machine</description>
39         </param>
40     </input>
41
42     <attrib name="interactiveSession" type="boolean" read-only="false">
43         <value encoded="n">false</value>
44         <description>This is set to true if the client wants an interactive session in the guest.</description>
45     </attrib>
46     <attrib name="result" type="number" read-only="false">
47         <value encoded="n">__NULL__</value>
48         <description>The pid of the program started.</description>
49     </attrib>
50     <attrib name="ad_password" type="SecureString" read-only="false">
51         <value encoded="n">__NULL__</value>
52         <description>Result of running the SSH command</description>
53     </attrib>
54     <attrib name="ad_param" type="string" read-only="false">
55         <value encoded="n"/>
56     </attrib>
57     <attrib name="ad_domain_user" type="string" read-only="false">
58         <value encoded="n"/>
59         <description>User with create computer privs in AD</description>
60     </attrib>
61     <attrib name="ad_log" type="string" read-only="false">
62         <value encoded="n">c:\etc\logs\JOIN.ok</value>
63         <description>Path in virtual machine to check</description>
64     </attrib>
65     <attrib name="errorCode" type="string" read-only="false">
66         <value encoded="n"/>
67     </attrib>
68     <attrib name="sleepTime" type="number" read-only="false">
69         <value encoded="n">10.0</value>
70         <description>Time to sleep in seconds</description>
71     </attrib>
72     <attrib name="exists" type="boolean" read-only="false">
73         <value encoded="n">false</value>
74         <description>True if directory exists.</description>
75     </attrib>
76     <attrib name="ad_error" type="string" read-only="false">
77         <value encoded="n">c:\etc\logs\JOIN.error</value>
78         <description>If exists, means that we where not able to join ad</description>
79     </attrib>
80     <attrib name="roles_param" type="string" read-only="false">
81         <value encoded="n">__NULL__</value>
82     </attrib>
83     <attrib name="roleadd_finish" type="string" read-only="false">
84         <value encoded="n">c:\etc\logs\roleadd.finish</value>
85         <description>If exists, means that we are done adding roles</description>
86     </attrib>
87     <attrib name="finish_param" type="string" read-only="false">
88         <value encoded="n"/>
89     </attrib>
90     <attrib name="AD" type="boolean" read-only="false">
91         <value encoded="n">true</value>
92     </attrib>
93     <attrib name="powerShell" type="string" read-only="false">
94         <value encoded="n">/c powershell -NoProfile -ExecutionPolicy UnRestricted -File</value>
95         <description>Powershell CMD</description>
96     </attrib>
97     <attrib name="actionResult" type="boolean" read-only="false">
98         <value encoded="n">false</value>
99     </attrib>
100     <attrib name="dos_path" type="string" read-only="false">
101         <value encoded="n">c:\etc</value>
102         <description>Path to cmd.exe</description>
103     </attrib>
104     <attrib name="vmUsername" type="string" read-only="false">
105         <value encoded="n">Administrator</value>
106         <description>Username for the virtual machine</description>
107     </attrib>
108     <attrib name="programPath" type="string" read-only="false">
109         <value encoded="n">c:\windows\system32\cmd.exe</value>
110         <description>The absolute path to the program to start. For Linux guest operating systems, /bin/bash is used to start the program.  For Solaris guest operating systems, /bin/bash is used to start the program if it exists. Otherwise /bin/sh is used. If /bin/sh is used, then the process ID returned will be that of the shell used to start the program, rather than the program itself, due to the differences in how /bin/sh and /bin/bash work. This PID will still be usable for watching the process with this API to find its exit code and elapsed time.</description>
111     </attrib>
112     <attrib name="environment" type="Array/string" read-only="false">
113         <value encoded="n">__NULL__</value>
114         <description>An array of environment variables, specified in the guest OS notation (eg PATH=c:\bin;c:\windows\system32 or LD_LIBRARY_PATH=/usr/lib:/lib), to be set for the program being run. Note that these are not additions to the default environment variables; they define the complete set available to the program. If none are specified the values are guest dependent.</description>
115     </attrib>
116     <attrib name="admin_users" type="Array/string" read-only="false">
117         <value encoded="n">#{#string#p01-windows-admins-renamed#}#</value>
118         <description>Array of groups/users whith Administrator access</description>
119     </attrib>
120     <attrib name="user" type="AD:User" read-only="false">
121         <value encoded="n">__NULL__</value>
122         <description>User to disable</description>
123     </attrib>
124     <attrib name="ipv6_param" type="string" read-only="false">
125         <value encoded="n"/>
126     </attrib>
127     <attrib name="ipv6_finish" type="string" read-only="false">
128         <value encoded="n">c:\etc\logs\ipv6.finish</value>
129     </attrib>
130     <attrib name="ADcomputer" type="string" read-only="false">
131         <value encoded="n"/>
132     </attrib>
133     <attrib name="counter" type="number" read-only="false">
134         <value encoded="n">1.0</value>
135         <description>counter to increment</description>
136     </attrib>
137     <attrib name="ou" type="string" read-only="false">
138         <value encoded="n"/>
139     </attrib>
140     <attrib name="pollingRate" type="number" read-only="false">
141         <value encoded="n">5.0</value>
142         <description>Time between all request information on the tools [seconds]</description>
143     </attrib>
144     <attrib name="fqdn" type="string" read-only="false">
145         <value encoded="n"/>
146         <description>fullt hostname med domene</description>
147     </attrib>
148     <attrib name="timeout" type="number" read-only="false">
149         <value encoded="n">120.0</value>
150         <description>Timeout before throwing a timeout exception [minutes]</description>
151     </attrib>
152     <attrib name="addNumberToName" type="boolean" read-only="false">
153         <value encoded="n">false</value>
154         <description>Specify if the DNS name has an automatically number added at end (not known at clone time)</description>
155     </attrib>
156     <attrib name="sleep4boot" type="number" read-only="false">
157         <value encoded="n">60.0</value>
158         <description>Time to sleep in seconds</description>
159     </attrib>
160     <workflow-note x="1460.0" y="163.63636363636363" w="664.0" h="77.0">
161         <description>Install monitoring software/licenses and reboot</description>
162     </workflow-note>
163     <workflow-note x="1196.0" y="0.0" w="376.0" h="141.0">
164         <description>Add ipv6</description>
165     </workflow-note>
166     <workflow-note x="236.0" y="185.90909090909088" w="252.0" h="190.0">
167         <description>Join Active Directory</description>
168     </workflow-note>
169     <workflow-note x="218.0" y="69.72727272727272" w="668.0" h="61.0">
170         <description>Prepare variables</description>
171     </workflow-note>
172     <workflow-note x="1020.0" y="208.09090909090907" w="384.0" h="164.0">
173         <description>Add windows roles</description>
174     </workflow-note>
175
176     <workflow-item name="item0" out-name="item18" type="link" linked-workflow-id="C98080808080808080808080808080805E80808001322751030482b80adf61e7c">
177         <display-name>ad_join</display-name>
178
179         <in-binding>
180             <bind name="vmUsername" type="string" export-name="vmUsername">
181                 <description>Username for the virtual machine</description>
182             </bind>
183             <bind name="vmPassword" type="SecureString" export-name="vmPassword">
184                 <description>Password for the virtual machine</description>
185             </bind>
186             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
187                 <description>Virtual machine</description>
188             </bind>
189             <bind name="interactiveSession" type="boolean" export-name="interactiveSession">
190                 <description>This is set to true if the client wants an interactive session in the guest.</description>
191             </bind>
192             <bind name="programPath" type="string" export-name="programPath">
193                 <description>The absolute path to the program to start. For Linux guest operating systems, /bin/bash is used to start the program.  For Solaris guest operating systems, /bin/bash is used to start the program if it exists. Otherwise /bin/sh is used. If /bin/sh is used, then the process ID returned will be that of the shell used to start the program, rather than the program itself, due to the differences in how /bin/sh and /bin/bash work. This PID will still be usable for watching the process with this API to find its exit code and elapsed time.</description>
194             </bind>
195             <bind name="arguments" type="string" export-name="ad_param">
196                 <description>The arguments to the program. In Linux and Solaris guest operating systems, the program will be executed by a guest shell. This allows stdio redirection, but may also require that characters which must be escaped to the shell also be escaped on the command line provided. For Windows guest operating systems, prefixing the command with "cmd /c" can provide stdio redirection.</description>
197             </bind>
198             <bind name="workingDirectory" type="string" export-name="dos_path">
199                 <description>The absolute path of the working directory for the program to be run. VMware recommends explicitly setting the working directory for the program to be run. If this value is unset or is an empty string, the behavior depends on the guest operating system. For Linux guest operating systems, if this value is unset or is an empty string, the working directory will be the home directory of the user associated with the guest authentication. For other guest operating systems, if this value is unset, the behavior is unspecified.</description>
200             </bind>
201             <bind name="environment" type="Array/string" export-name="environment">
202                 <description>An array of environment variables, specified in the guest OS notation (eg PATH=c:\bin;c:\windows\system32 or LD_LIBRARY_PATH=/usr/lib:/lib), to be set for the program being run. Note that these are not additions to the default environment variables; they define the complete set available to the program. If none are specified the values are guest dependent.</description>
203             </bind>
204         </in-binding>
205
206         <out-binding>
207             <bind name="result" type="number" export-name="result">
208                 <description>The pid of the program started.</description>
209             </bind>
210         </out-binding>
211
212         <description>
213 Starts a program in the guest operating system.
214 A process started this way can have its status queried with this API. When the process completes, its exit code and end time will be available for 5 minutes after completion.
215         </description>
216
217         <position x="244.5" y="209.95454545454544"/>
218     </workflow-item>
219
220     <workflow-item name="item2" out-name="item0" throw-bind-name="errorCode" type="task">
221         <display-name>prepare AD join cmd</display-name>
222
223         <script encoded="false">
224 /*
225         Define how to trigger powershell cmd
226 */
227
228 var join_ad='c:\\etc\\scripts\\join_ad.ps1 -domainName '+ad_domain_name+' -user '+ad_domain_user+' -passwd '+ad_password+' -ou "'+ou+'" ';
229
230 var finish='c:\\etc\\scripts\\WindowsFinish.ps1 -password '+vmPassword+'';
231 if (admin_users) {
232         if (admin_users.length &gt; 0) {
233                 var finish='c:\\etc\\scripts\\WindowsFinish.ps1  -ressursperson "'+admin_users.join(",")+ '" -chpasswd '+ad_domain_id+' -domainName '+ad_domain_name+'';
234         }
235 }
236 System.log(finish);
237 finish_param=powerShell+" "+finish;
238 ad_param=powerShell+" "+join_ad;
239         </script>
240
241         <in-binding>
242             <bind name="ad_password" type="SecureString" export-name="ad_password">
243                 <description>Result of running the SSH command</description>
244             </bind>
245             <bind name="ad_domain_user" type="string" export-name="ad_domain_user"/>
246             <bind name="ad_domain_name" type="string" export-name="ad_domain_name"/>
247             <bind name="powerShell" type="string" export-name="powerShell">
248                 <description>Powershell CMD</description>
249             </bind>
250             <bind name="vmPassword" type="SecureString" export-name="vmPassword">
251                 <description>Password for the virtual machine</description>
252             </bind>
253             <bind name="admin_users" type="Array/string" export-name="admin_users"/>
254             <bind name="ad_domain_id" type="number" export-name="ad_domain_id">
255                 <description>Domain id from database. if &gt; 0 add to AD</description>
256             </bind>
257             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
258                 <description>Virtual machine</description>
259             </bind>
260             <bind name="ou" type="string" export-name="ou"/>
261         </in-binding>
262
263         <out-binding>
264             <bind name="ad_param" type="string" export-name="ad_param"/>
265             <bind name="finish_param" type="string" export-name="finish_param"/>
266         </out-binding>
267
268         <position x="224.5" y="82.68181818181817"/>
269     </workflow-item>
270
271     <workflow-item name="item3" out-name="item20" throw-bind-name="errorCode" type="link" linked-workflow-id="C3808080808080808080808080808080AA80808001322751030482b80adf61e7c">
272         <display-name>Check ad_join.log</display-name>
273
274         <in-binding>
275             <bind name="vmUsername" type="string" export-name="vmUsername">
276                 <description>Username for the virtual machine</description>
277             </bind>
278             <bind name="vmPassword" type="SecureString" export-name="vmPassword">
279                 <description>Password for the virtual machine</description>
280             </bind>
281             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
282                 <description>Virtual machine</description>
283             </bind>
284             <bind name="path" type="string" export-name="ad_log">
285                 <description>Path in virtual machine to check</description>
286             </bind>
287         </in-binding>
288
289         <out-binding>
290             <bind name="exists" type="boolean" export-name="exists">
291                 <description>True if directory exists.</description>
292             </bind>
293         </out-binding>
294
295         <description>
296 Checks to see if a directory exists in a guest VM.
297 Output parameter result is a boolean.
298         </description>
299
300         <position x="244.5" y="328.1363636363636"/>
301     </workflow-item>
302
303     <workflow-item name="item4" out-name="item5" throw-bind-name="errorCode" type="link" linked-workflow-id="C3808080808080808080808080808080AA80808001322751030482b80adf61e7c">
304         <display-name>Check for JOIN.error</display-name>
305
306         <in-binding>
307             <bind name="vmUsername" type="string" export-name="vmUsername">
308                 <description>Username for the virtual machine</description>
309             </bind>
310             <bind name="vmPassword" type="SecureString" export-name="vmPassword">
311                 <description>Password for the virtual machine</description>
312             </bind>
313             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
314                 <description>Virtual machine</description>
315             </bind>
316             <bind name="path" type="string" export-name="ad_error">
317                 <description>Path in virtual machine to check</description>
318             </bind>
319         </in-binding>
320
321         <out-binding>
322             <bind name="exists" type="boolean" export-name="exists">
323                 <description>True if directory exists.</description>
324             </bind>
325         </out-binding>
326
327         <description>
328 Checks to see if a directory exists in a guest VM.
329 Output parameter result is a boolean.
330         </description>
331
332         <position x="384.5" y="264.5"/>
333     </workflow-item>
334
335     <workflow-item name="item5" out-name="item0" type="condition" alt-out-name="item31" comparator="0">
336         <display-name>Decision</display-name>
337
338         <script encoded="false">
339 //Generated by the system, cannot be edited
340 return (exists == false) ;
341         </script>
342
343         <in-binding>
344             <bind name="exists" type="boolean" export-name="exists"/>
345         </in-binding>
346         <condition name="exists" type="boolean" comparator="1" label="null">false</condition>
347
348         <position x="384.5" y="199.95454545454544"/>
349     </workflow-item>
350
351     <workflow-item name="item7" out-name="item17" type="link" linked-workflow-id="C98080808080808080808080808080805E80808001322751030482b80adf61e7c">
352         <display-name>Add roles</display-name>
353
354         <in-binding>
355             <bind name="vmUsername" type="string" export-name="vmUsername">
356                 <description>Username for the virtual machine</description>
357             </bind>
358             <bind name="vmPassword" type="SecureString" export-name="vmPassword">
359                 <description>Password for the virtual machine</description>
360             </bind>
361             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
362                 <description>Virtual machine</description>
363             </bind>
364             <bind name="interactiveSession" type="boolean" export-name="interactiveSession">
365                 <description>This is set to true if the client wants an interactive session in the guest.</description>
366             </bind>
367             <bind name="programPath" type="string" export-name="programPath">
368                 <description>The absolute path to the program to start. For Linux guest operating systems, /bin/bash is used to start the program.  For Solaris guest operating systems, /bin/bash is used to start the program if it exists. Otherwise /bin/sh is used. If /bin/sh is used, then the process ID returned will be that of the shell used to start the program, rather than the program itself, due to the differences in how /bin/sh and /bin/bash work. This PID will still be usable for watching the process with this API to find its exit code and elapsed time.</description>
369             </bind>
370             <bind name="arguments" type="string" export-name="roles_param">
371                 <description>The arguments to the program. In Linux and Solaris guest operating systems, the program will be executed by a guest shell. This allows stdio redirection, but may also require that characters which must be escaped to the shell also be escaped on the command line provided. For Windows guest operating systems, prefixing the command with "cmd /c" can provide stdio redirection.</description>
372             </bind>
373             <bind name="workingDirectory" type="string" export-name="dos_path">
374                 <description>The absolute path of the working directory for the program to be run. VMware recommends explicitly setting the working directory for the program to be run. If this value is unset or is an empty string, the behavior depends on the guest operating system. For Linux guest operating systems, if this value is unset or is an empty string, the working directory will be the home directory of the user associated with the guest authentication. For other guest operating systems, if this value is unset, the behavior is unspecified.</description>
375             </bind>
376             <bind name="environment" type="Array/string" export-name="environment">
377                 <description>An array of environment variables, specified in the guest OS notation (eg PATH=c:\bin;c:\windows\system32 or LD_LIBRARY_PATH=/usr/lib:/lib), to be set for the program being run. Note that these are not additions to the default environment variables; they define the complete set available to the program. If none are specified the values are guest dependent.</description>
378             </bind>
379         </in-binding>
380
381         <out-binding>
382             <bind name="result" type="number" export-name="result">
383                 <description>The pid of the program started.</description>
384             </bind>
385         </out-binding>
386
387         <description>
388 Starts a program in the guest operating system.
389 A process started this way can have its status queried with this API. When the process completes, its exit code and end time will be available for 5 minutes after completion.
390         </description>
391
392         <position x="1024.5" y="264.5"/>
393     </workflow-item>
394
395     <workflow-item name="item8" out-name="item15" throw-bind-name="errorCode" type="link" linked-workflow-id="C3808080808080808080808080808080AA80808001322751030482b80adf61e7c">
396         <display-name>Check roleadd.finish</display-name>
397
398         <in-binding>
399             <bind name="vmUsername" type="string" export-name="vmUsername">
400                 <description>Username for the virtual machine</description>
401             </bind>
402             <bind name="vmPassword" type="SecureString" export-name="vmPassword">
403                 <description>Password for the virtual machine</description>
404             </bind>
405             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
406                 <description>Virtual machine</description>
407             </bind>
408             <bind name="path" type="string" export-name="roleadd_finish">
409                 <description>Path in virtual machine to check</description>
410             </bind>
411         </in-binding>
412
413         <out-binding>
414             <bind name="exists" type="boolean" export-name="exists">
415                 <description>True if directory exists.</description>
416             </bind>
417         </out-binding>
418
419         <description>
420 Checks to see if a directory exists in a guest VM.
421 Output parameter result is a boolean.
422         </description>
423
424         <position x="1264.5" y="264.5"/>
425     </workflow-item>
426
427     <workflow-item name="item9" out-name="item37" type="link" linked-workflow-id="C98080808080808080808080808080805E80808001322751030482b80adf61e7c">
428         <display-name>Windows finish</display-name>
429
430         <in-binding>
431             <bind name="vmUsername" type="string" export-name="vmUsername">
432                 <description>Username for the virtual machine</description>
433             </bind>
434             <bind name="vmPassword" type="SecureString" export-name="vmPassword">
435                 <description>Password for the virtual machine</description>
436             </bind>
437             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
438                 <description>Virtual machine</description>
439             </bind>
440             <bind name="interactiveSession" type="boolean" export-name="interactiveSession">
441                 <description>This is set to true if the client wants an interactive session in the guest.</description>
442             </bind>
443             <bind name="programPath" type="string" export-name="programPath">
444                 <description>The absolute path to the program to start. For Linux guest operating systems, /bin/bash is used to start the program.  For Solaris guest operating systems, /bin/bash is used to start the program if it exists. Otherwise /bin/sh is used. If /bin/sh is used, then the process ID returned will be that of the shell used to start the program, rather than the program itself, due to the differences in how /bin/sh and /bin/bash work. This PID will still be usable for watching the process with this API to find its exit code and elapsed time.</description>
445             </bind>
446             <bind name="arguments" type="string" export-name="finish_param">
447                 <description>The arguments to the program. In Linux and Solaris guest operating systems, the program will be executed by a guest shell. This allows stdio redirection, but may also require that characters which must be escaped to the shell also be escaped on the command line provided. For Windows guest operating systems, prefixing the command with "cmd /c" can provide stdio redirection.</description>
448             </bind>
449             <bind name="workingDirectory" type="string" export-name="dos_path">
450                 <description>The absolute path of the working directory for the program to be run. VMware recommends explicitly setting the working directory for the program to be run. If this value is unset or is an empty string, the behavior depends on the guest operating system. For Linux guest operating systems, if this value is unset or is an empty string, the working directory will be the home directory of the user associated with the guest authentication. For other guest operating systems, if this value is unset, the behavior is unspecified.</description>
451             </bind>
452             <bind name="environment" type="Array/string" export-name="environment">
453                 <description>An array of environment variables, specified in the guest OS notation (eg PATH=c:\bin;c:\windows\system32 or LD_LIBRARY_PATH=/usr/lib:/lib), to be set for the program being run. Note that these are not additions to the default environment variables; they define the complete set available to the program. If none are specified the values are guest dependent.</description>
454             </bind>
455         </in-binding>
456
457         <out-binding>
458             <bind name="result" type="number" export-name="result">
459                 <description>The pid of the program started.</description>
460             </bind>
461         </out-binding>
462
463         <description>
464 Starts a program in the guest operating system.
465 A process started this way can have its status queried with this API. When the process completes, its exit code and end time will be available for 5 minutes after completion.
466         </description>
467
468         <position x="1484.5" y="191.77272727272725"/>
469     </workflow-item>
470
471     <workflow-item name="item11" out-name="item6" type="link" linked-workflow-id="2cdac1c6-1c4b-4fd4-aa62-a2736a71f7e7">
472         <display-name>error</display-name>
473
474         <in-binding>
475             <bind name="message" type="string" export-name="errorCode"/>
476         </in-binding>
477
478         <out-binding/>
479
480         <description>Looger error melding til email og database</description>
481
482         <position x="684.5" y="164.5"/>
483     </workflow-item>
484
485     <workflow-item name="item12" out-name="item32" type="custom-condition" alt-out-name="item13">
486         <display-name>Add to AD or not?</display-name>
487
488         <script encoded="false">
489 if (ad_domain_id == 0) {
490         return false;
491 } else {
492         return true;
493 }
494         </script>
495
496         <in-binding>
497             <bind name="AD" type="boolean" export-name="AD"/>
498             <bind name="ad_domain_id" type="number" export-name="ad_domain_id"/>
499         </in-binding>
500
501         <position x="724.5" y="9.045454545454543"/>
502     </workflow-item>
503
504     <workflow-item name="item13" out-name="item7" type="task">
505         <display-name>Scriptable task</display-name>
506
507         <script encoded="false">
508 /*
509     Define how to trigger powershell cmd
510 */
511
512 System.log("Not adding new VM to AD");
513         </script>
514
515         <in-binding/>
516
517         <out-binding/>
518
519         <position x="764.5" y="82.68181818181817"/>
520     </workflow-item>
521
522     <workflow-item name="item14" out-name="item12" type="task">
523         <display-name>Scriptable task</display-name>
524
525         <script encoded="false">
526 /*
527     Define how to trigger powershell cmd
528 */
529
530 var addRoles='c:\\etc\\scripts\\addRoles.ps1 -vlan '+vlan_name+' -DnsDomain uio.no';
531 if (windows_roles) {
532         if (windows_roles.length &gt; 0) {
533                 addRoles='c:\\etc\\scripts\\addRoles.ps1 -roles '+windows_roles.join(",")+' -vlan '+vlan_name+' -DnsDomain uio.no';
534         }
535 }
536 var adm = admin_users.join(",");
537 var finish="c:\\etc\\scripts\\WindowsFinish.ps1 -ressursperson "+adm+" -domainName "+ad_domain_name+" -password "+vmPassword+"";
538
539 roles_param=powerShell+" "+addRoles;
540 finish_param=powerShell+" "+finish;
541 System.log(finish_param);
542
543 if (ipv6address.length &gt; 0) {
544         var ipv6='c:\\etc\\scripts\\setipv6.ps1 -ipAddress '+ipv6address+' -PrefixLength '+ipv6Prefixlen+' -DefaultGateway '+ipv6gateway+' -dns '+ipv6dnsServerList.join(",")+'';
545         ipv6_param=powerShell+" "+ipv6;
546 } else {
547         ipv6address='false';
548 }
549
550 fqdn=vm.name;
551 var hostname=fqdn.split(".",1);
552 ADcomputer=hostname.join(".");
553 System.log('Computer =&gt; '+ADcomputer);
554         </script>
555
556         <in-binding>
557             <bind name="vlan_name" type="string" export-name="vlan_name">
558                 <description>Vlan descriptive name</description>
559             </bind>
560             <bind name="windows_roles" type="Array/string" export-name="windows_roles">
561                 <description>Windows roles. Other workflow fetches roles from database</description>
562             </bind>
563             <bind name="powerShell" type="string" export-name="powerShell">
564                 <description>Powershell CMD</description>
565             </bind>
566             <bind name="vmPassword" type="SecureString" export-name="vmPassword">
567                 <description>Password for the virtual machine</description>
568             </bind>
569             <bind name="admin_users" type="Array/string" export-name="admin_users"/>
570             <bind name="ipv6address" type="string" export-name="ipv6address">
571                 <description>ipv6 ipaddresse</description>
572             </bind>
573             <bind name="ipv6Prefixlen" type="number" export-name="ipv6Prefixlen">
574                 <description>ipv6 Netmaske</description>
575             </bind>
576             <bind name="ipv6gateway" type="string" export-name="ipv6gateway">
577                 <description>ipv6 gateway</description>
578             </bind>
579             <bind name="ipv6dnsServerList" type="Array/string" export-name="ipv6dnsServerList">
580                 <description>ipv6 dns server liste</description>
581             </bind>
582             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
583                 <description>Virtual machine</description>
584             </bind>
585             <bind name="ad_domain_name" type="string" export-name="ad_domain_name">
586                 <description>Domene navn</description>
587             </bind>
588         </in-binding>
589
590         <out-binding>
591             <bind name="roles_param" type="string" export-name="roles_param"/>
592             <bind name="finish_param" type="string" export-name="finish_param"/>
593             <bind name="ipv6_param" type="string" export-name="ipv6_param"/>
594             <bind name="ADcomputer" type="string" export-name="ADcomputer"/>
595             <bind name="fqdn" type="string" export-name="fqdn"/>
596         </out-binding>
597
598         <position x="544.5" y="19.045454545454543"/>
599     </workflow-item>
600
601     <workflow-item name="item15" out-name="item28" type="custom-condition" alt-out-name="item7">
602         <display-name>|</display-name>
603
604         <script encoded="false">
605 if (exists == false) {
606         return false;
607 } else {
608         return true;
609 }
610         </script>
611
612         <in-binding>
613             <bind name="exists" type="boolean" export-name="exists"/>
614         </in-binding>
615
616         <position x="1124.5" y="209.04545454545453"/>
617     </workflow-item>
618
619     <workflow-item name="item16" prototype-id="sleep" out-name="item17" content-mode="x" type="task">
620         <display-name>Sleep</display-name>
621
622         <script encoded="false">
623 //Auto-generated script
624 if ( sleepTime != null )  {
625         System.sleep(sleepTime*1000);
626 }
627 else  {
628         throw "'sleepTime' is NULL";
629 }
630         </script>
631
632         <in-binding>
633             <bind name="sleepTime" type="number" export-name="sleepTime">
634                 <description>Time to sleep in seconds</description>
635             </bind>
636         </in-binding>
637
638         <out-binding/>
639
640         <description>Sleep a given number of seconds</description>
641
642         <position x="1144.5" y="355.4090909090909"/>
643     </workflow-item>
644
645     <workflow-item name="item17" out-name="item8" catch-name="item16" throw-bind-name="errorCode" type="task" script-module="no.uio/CheckPidInVM">
646         <display-name>CheckPidInVM</display-name>
647
648         <script encoded="false">
649 //Auto generated script, cannot be modified !
650 actionResult = System.getModule("no.uio").CheckPidInVM(pid,vm,vmUsername,vmPassword) ;
651         </script>
652
653         <in-binding>
654             <bind name="pid" type="number" export-name="result"/>
655             <bind name="vm" type="VC:VirtualMachine" export-name="vm"/>
656             <bind name="vmUsername" type="string" export-name="vmUsername"/>
657             <bind name="vmPassword" type="SecureString" export-name="vmPassword"/>
658         </in-binding>
659
660         <out-binding>
661             <bind name="actionResult" type="boolean" export-name="actionResult"/>
662         </out-binding>
663
664         <position x="1124.5" y="300.8636363636363"/>
665     </workflow-item>
666
667     <workflow-item name="item18" out-name="item3" catch-name="item19" throw-bind-name="errorCode" type="task" script-module="no.uio/CheckPidInVM">
668         <display-name>CheckPidInVM</display-name>
669
670         <script encoded="false">
671 //Auto generated script, cannot be modified !
672 actionResult = System.getModule("no.uio").CheckPidInVM(pid,vm,vmUsername,vmPassword) ;
673         </script>
674
675         <in-binding>
676             <bind name="pid" type="number" export-name="result"/>
677             <bind name="vm" type="VC:VirtualMachine" export-name="vm"/>
678             <bind name="vmUsername" type="string" export-name="vmUsername"/>
679             <bind name="vmPassword" type="SecureString" export-name="vmPassword"/>
680         </in-binding>
681
682         <out-binding>
683             <bind name="actionResult" type="boolean" export-name="actionResult"/>
684         </out-binding>
685
686         <position x="244.5" y="273.59090909090907"/>
687     </workflow-item>
688
689     <workflow-item name="item19" prototype-id="sleep" out-name="item18" content-mode="x" type="task">
690         <display-name>Sleep</display-name>
691
692         <script encoded="false">
693 //Auto-generated script
694 if ( sleepTime != null )  {
695         System.sleep(sleepTime*1000);
696 }
697 else  {
698         throw "'sleepTime' is NULL";
699 }
700         </script>
701
702         <in-binding>
703             <bind name="sleepTime" type="number" export-name="sleepTime">
704                 <description>Time to sleep in seconds</description>
705             </bind>
706         </in-binding>
707
708         <out-binding/>
709
710         <description>Sleep a given number of seconds</description>
711
712         <position x="124.5" y="273.59090909090907"/>
713     </workflow-item>
714
715     <workflow-item name="item20" out-name="item22" type="custom-condition" alt-out-name="item4">
716         <display-name>|</display-name>
717
718         <script encoded="false">
719 if (exists == false) {
720         return false;
721 } else {
722         return true;
723 }
724         </script>
725
726         <in-binding>
727             <bind name="exists" type="boolean" export-name="exists"/>
728         </in-binding>
729
730         <position x="384.5" y="318.1363636363636"/>
731     </workflow-item>
732
733     <workflow-item name="item6" throw-bind-name="errorCode" type="end" end-mode="1">
734         <position x="804.5" y="154.5"/>
735     </workflow-item>
736
737     <workflow-item name="item1" out-name="item2" type="link" linked-workflow-id="21827d8d-4e4b-4094-a41f-f2c5b8a3375e">
738         <display-name>get_ad_passwd</display-name>
739
740         <in-binding/>
741
742         <out-binding>
743             <bind name="ad_passwd" type="SecureString" export-name="ad_password"/>
744         </out-binding>
745
746         <description>Newroot12345</description>
747
748         <position x="364.5" y="82.68181818181817"/>
749     </workflow-item>
750
751     <workflow-item name="item23" out-name="item26" type="link" linked-workflow-id="C98080808080808080808080808080805E80808001322751030482b80adf61e7c">
752         <display-name>Define ip</display-name>
753
754         <in-binding>
755             <bind name="vmUsername" type="string" export-name="vmUsername">
756                 <description>Username for the virtual machine</description>
757             </bind>
758             <bind name="vmPassword" type="SecureString" export-name="vmPassword">
759                 <description>Password for the virtual machine</description>
760             </bind>
761             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
762                 <description>Virtual machine</description>
763             </bind>
764             <bind name="interactiveSession" type="boolean" export-name="interactiveSession">
765                 <description>This is set to true if the client wants an interactive session in the guest.</description>
766             </bind>
767             <bind name="programPath" type="string" export-name="programPath">
768                 <description>The absolute path to the program to start. For Linux guest operating systems, /bin/bash is used to start the program.  For Solaris guest operating systems, /bin/bash is used to start the program if it exists. Otherwise /bin/sh is used. If /bin/sh is used, then the process ID returned will be that of the shell used to start the program, rather than the program itself, due to the differences in how /bin/sh and /bin/bash work. This PID will still be usable for watching the process with this API to find its exit code and elapsed time.</description>
769             </bind>
770             <bind name="arguments" type="string" export-name="ipv6_param">
771                 <description>The arguments to the program. In Linux and Solaris guest operating systems, the program will be executed by a guest shell. This allows stdio redirection, but may also require that characters which must be escaped to the shell also be escaped on the command line provided. For Windows guest operating systems, prefixing the command with "cmd /c" can provide stdio redirection.</description>
772             </bind>
773             <bind name="workingDirectory" type="string" export-name="dos_path">
774                 <description>The absolute path of the working directory for the program to be run. VMware recommends explicitly setting the working directory for the program to be run. If this value is unset or is an empty string, the behavior depends on the guest operating system. For Linux guest operating systems, if this value is unset or is an empty string, the working directory will be the home directory of the user associated with the guest authentication. For other guest operating systems, if this value is unset, the behavior is unspecified.</description>
775             </bind>
776             <bind name="environment" type="Array/string" export-name="environment">
777                 <description>An array of environment variables, specified in the guest OS notation (eg PATH=c:\bin;c:\windows\system32 or LD_LIBRARY_PATH=/usr/lib:/lib), to be set for the program being run. Note that these are not additions to the default environment variables; they define the complete set available to the program. If none are specified the values are guest dependent.</description>
778             </bind>
779         </in-binding>
780
781         <out-binding>
782             <bind name="result" type="number" export-name="result">
783                 <description>The pid of the program started.</description>
784             </bind>
785         </out-binding>
786
787         <description>
788 Starts a program in the guest operating system.
789 A process started this way can have its status queried with this API. When the process completes, its exit code and end time will be available for 5 minutes after completion.
790         </description>
791
792         <position x="1204.5" y="55.40909090909091"/>
793     </workflow-item>
794
795     <workflow-item name="item24" out-name="item25" throw-bind-name="errorCode" type="link" linked-workflow-id="C3808080808080808080808080808080AA80808001322751030482b80adf61e7c">
796         <display-name>Check ipv6 finish</display-name>
797
798         <in-binding>
799             <bind name="vmUsername" type="string" export-name="vmUsername">
800                 <description>Username for the virtual machine</description>
801             </bind>
802             <bind name="vmPassword" type="SecureString" export-name="vmPassword">
803                 <description>Password for the virtual machine</description>
804             </bind>
805             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
806                 <description>Virtual machine</description>
807             </bind>
808             <bind name="path" type="string" export-name="ipv6_finish">
809                 <description>Path in virtual machine to check</description>
810             </bind>
811         </in-binding>
812
813         <out-binding>
814             <bind name="exists" type="boolean" export-name="exists">
815                 <description>True if directory exists.</description>
816             </bind>
817         </out-binding>
818
819         <description>
820 Checks to see if a directory exists in a guest VM.
821 Output parameter result is a boolean.
822         </description>
823
824         <position x="1444.5" y="55.40909090909091"/>
825     </workflow-item>
826
827     <workflow-item name="item25" out-name="item9" type="custom-condition" alt-out-name="item23">
828         <display-name>|</display-name>
829
830         <script encoded="false">
831 if (exists == false) {
832         return false;
833 } else {
834         return true;
835 }
836         </script>
837
838         <in-binding>
839             <bind name="exists" type="boolean" export-name="exists"/>
840         </in-binding>
841
842         <position x="1304.5" y="0.45454545454545325"/>
843     </workflow-item>
844
845     <workflow-item name="item26" out-name="item24" catch-name="item27" throw-bind-name="errorCode" type="task" script-module="no.uio/CheckPidInVM">
846         <display-name>CheckPidInVM</display-name>
847
848         <script encoded="false">
849 //Auto generated script, cannot be modified !
850 actionResult = System.getModule("no.uio").CheckPidInVM(pid,vm,vmUsername,vmPassword) ;
851         </script>
852
853         <in-binding>
854             <bind name="pid" type="number" export-name="result"/>
855             <bind name="vm" type="VC:VirtualMachine" export-name="vm"/>
856             <bind name="vmUsername" type="string" export-name="vmUsername"/>
857             <bind name="vmPassword" type="SecureString" export-name="vmPassword"/>
858         </in-binding>
859
860         <out-binding>
861             <bind name="actionResult" type="boolean" export-name="actionResult"/>
862         </out-binding>
863
864         <position x="1304.5" y="91.77272727272727"/>
865     </workflow-item>
866
867     <workflow-item name="item27" prototype-id="sleep" out-name="item26" content-mode="x" type="task">
868         <display-name>Sleep</display-name>
869
870         <script encoded="false">
871 //Auto-generated script
872 if ( sleepTime != null )  {
873         System.sleep(sleepTime*1000);
874 }
875 else  {
876         throw "'sleepTime' is NULL";
877 }
878         </script>
879
880         <in-binding>
881             <bind name="sleepTime" type="number" export-name="sleepTime">
882                 <description>Time to sleep in seconds</description>
883             </bind>
884         </in-binding>
885
886         <out-binding/>
887
888         <description>Sleep a given number of seconds</description>
889
890         <position x="1304.5" y="146.3181818181818"/>
891     </workflow-item>
892
893     <workflow-item name="item28" out-name="item9" type="condition" alt-out-name="item23" comparator="0">
894         <display-name>ipv6 or not</display-name>
895
896         <script encoded="false">
897 //Generated by the system, cannot be edited
898 return (ipv6address != null) ;
899         </script>
900
901         <in-binding>
902             <bind name="ipv6address" type="string" export-name="ipv6address"/>
903         </in-binding>
904         <condition name="ipv6address" type="string" comparator="3" label="null"/>
905
906         <position x="1064.5" y="136.3181818181818"/>
907     </workflow-item>
908
909     <workflow-item name="item21" out-name="item11" type="link" linked-workflow-id="edb09c46-fd03-405a-b1a5-948eb9b887e3">
910         <display-name>disable_and_untag_tsduser</display-name>
911
912         <in-binding>
913             <bind name="user" type="AD:User" export-name="user">
914                 <description>User to disable</description>
915             </bind>
916         </in-binding>
917
918         <out-binding/>
919
920         <description>
921 Disable tsduser, so its unusable when not used by a Orchestrator flow.
922 Also untaggs the get_ad_passwd flow, freeing it for use for other objects
923         </description>
924
925         <position x="644.5" y="209.95454545454544"/>
926     </workflow-item>
927
928     <workflow-item name="item22" out-name="item7" type="link" linked-workflow-id="edb09c46-fd03-405a-b1a5-948eb9b887e3">
929         <display-name>disable_and_untag_tsduser</display-name>
930
931         <in-binding>
932             <bind name="user" type="AD:User" export-name="user">
933                 <description>User to disable</description>
934             </bind>
935         </in-binding>
936
937         <out-binding/>
938
939         <description>
940 Disable tsduser, so its unusable when not used by a Orchestrator flow.
941 Also untaggs the get_ad_passwd flow, freeing it for use for other objects
942         </description>
943
944         <position x="584.5" y="300.8636363636363"/>
945     </workflow-item>
946
947     <workflow-item name="item29" out-name="item2" type="link" linked-workflow-id="6ba8217c-e631-4bfb-80fc-16cec2e5c369">
948         <display-name>get_ad_computer</display-name>
949
950         <in-binding>
951             <bind name="computername" type="string" export-name="ADcomputer"/>
952         </in-binding>
953
954         <out-binding>
955             <bind name="ou" type="string" export-name="ou"/>
956         </out-binding>
957
958         <position x="364.5" y="128.13636363636363"/>
959     </workflow-item>
960
961     <workflow-item name="item30" prototype-id="increase-counter" out-name="item32" content-mode="x" type="task">
962         <display-name>Increase counter</display-name>
963
964         <script encoded="false">
965 //Auto-generated script
966 counter = counter+1;
967         </script>
968
969         <in-binding>
970             <bind name="counter" type="number" export-name="counter">
971                 <description>counter to increment</description>
972             </bind>
973         </in-binding>
974
975         <out-binding>
976             <bind name="counter" type="number" export-name="counter">
977                 <description>counter incremented</description>
978             </bind>
979         </out-binding>
980
981         <description>Increment a counter by one</description>
982
983         <position x="484.5" y="155.4090909090909"/>
984     </workflow-item>
985
986     <workflow-item name="item31" out-name="item30" type="condition" alt-out-name="item21" comparator="0">
987         <display-name>Decision</display-name>
988
989         <script encoded="false">
990 //Generated by the system, cannot be edited
991 return (counter &lt;= 10.0) ;
992         </script>
993
994         <in-binding>
995             <bind name="counter" type="number" export-name="counter"/>
996         </in-binding>
997         <condition name="counter" type="number" comparator="6" label="null">10.0</condition>
998
999         <position x="524.5" y="199.95454545454544"/>
1000     </workflow-item>
1001
1002     <workflow-item name="item32" out-name="item1" type="condition" alt-out-name="item29" comparator="0">
1003         <display-name>Decision</display-name>
1004
1005         <script encoded="false">
1006 //Generated by the system, cannot be edited
1007 return (ou != null) ;
1008         </script>
1009
1010         <in-binding>
1011             <bind name="ou" type="string" export-name="ou"/>
1012         </in-binding>
1013         <condition name="ou" type="string" comparator="3" label="null"/>
1014
1015         <position x="504.5" y="72.68181818181817"/>
1016     </workflow-item>
1017
1018     <workflow-item name="item33" out-name="item14" type="link" linked-workflow-id="1f0fc470-006c-4c15-a3b9-95e2e7540f22">
1019         <display-name>global_parameters</display-name>
1020
1021         <in-binding/>
1022
1023         <out-binding>
1024             <bind name="mailto" type="string"/>
1025             <bind name="smtp_server" type="string"/>
1026             <bind name="smtp_port" type="string"/>
1027             <bind name="database" type="SQL:Database"/>
1028             <bind name="vmPassword" type="SecureString"/>
1029             <bind name="ou" type="string" export-name="ou"/>
1030             <bind name="ad_domain_user" type="string" export-name="ad_domain_user"/>
1031             <bind name="domain_name" type="string"/>
1032             <bind name="ad_controll" type="boolean"/>
1033             <bind name="ssh_shell_server" type="string"/>
1034             <bind name="manage_cpu_ram" type="boolean"/>
1035         </out-binding>
1036
1037         <position x="404.5" y="19.045454545454543"/>
1038     </workflow-item>
1039
1040     <workflow-item name="item34" type="end" end-mode="0">
1041         <position x="2044.5" y="181.77272727272725"/>
1042     </workflow-item>
1043
1044     <workflow-item name="item36" out-name="item34" type="task" script-module="com.vmware.library.vc.vm.tools/vim3WaitDnsNameInTools">
1045         <display-name>vim3WaitDnsNameInTools</display-name>
1046
1047         <script encoded="false">
1048 //Auto generated script, cannot be modified !
1049 System.getModule("com.vmware.library.vc.vm.tools").vim3WaitDnsNameInTools(vm,pollingRate,dnsNameToWait,timeout,addNumberToName) ;
1050         </script>
1051
1052         <in-binding>
1053             <bind name="vm" type="VC:VirtualMachine" export-name="vm">
1054                 <description>VM in which the action look to get the new DNS Name</description>
1055             </bind>
1056             <bind name="pollingRate" type="number" export-name="pollingRate">
1057                 <description>Time between all request information on the tools [seconds]</description>
1058             </bind>
1059             <bind name="dnsNameToWait" type="string" export-name="fqdn">
1060                 <description>Define a specific DNS name to wait for (either in compute.dunes.ch or compute form)</description>
1061             </bind>
1062             <bind name="timeout" type="number" export-name="timeout">
1063                 <description>Timeout before throwing a timeout exception [minutes]</description>
1064             </bind>
1065             <bind name="addNumberToName" type="boolean" export-name="addNumberToName">
1066                 <description>Specify if the DNS name has an automatically number added at end (not known at clone time)</description>
1067             </bind>
1068         </in-binding>
1069
1070         <out-binding/>
1071
1072         <description>
1073 Wait for a given name in the DNS guest informations (VMware tools).
1074
1075 Exception:
1076 - Timeout: When timeout is reached
1077         </description>
1078
1079         <position x="1864.5" y="191.77272727272725"/>
1080     </workflow-item>
1081
1082     <workflow-item name="item37" prototype-id="sleep" out-name="item36" content-mode="x" type="task">
1083         <display-name>Sleep</display-name>
1084
1085         <script encoded="false">
1086 //Auto-generated script
1087 if ( sleepTime != null )  {
1088         System.sleep(sleepTime*1000);
1089 }
1090 else  {
1091         throw "'sleepTime' is NULL";
1092 }
1093         </script>
1094
1095         <in-binding>
1096             <bind name="sleepTime" type="number" export-name="sleep4boot">
1097                 <description>Time to sleep in seconds</description>
1098             </bind>
1099         </in-binding>
1100
1101         <out-binding/>
1102
1103         <description>Sleep a given number of seconds</description>
1104
1105         <position x="1664.5" y="191.77272727272725"/>
1106     </workflow-item>
1107
1108     <presentation>
1109         <p-param name="vm">
1110             <desc>Virtual machine</desc>
1111             <p-qual kind="static" name="mandatory" type="boolean">true</p-qual>
1112         </p-param>
1113         <p-param name="windows_roles">
1114             <desc>Windows roles. Other workflow fetches roles from database</desc>
1115         </p-param>
1116         <p-param name="vlan_name">
1117             <desc>Vlan descriptive name</desc>
1118         </p-param>
1119         <p-param name="ad_domain_id">
1120             <desc>ad_domain_id</desc>
1121         </p-param>
1122         <p-param name="ad_domain_name">
1123             <desc>Domene navn</desc>
1124         </p-param>
1125         <p-param name="ipv6address">
1126             <desc>ipv6 ipaddresse</desc>
1127         </p-param>
1128         <p-param name="ipv6Prefixlen">
1129             <desc>ipv6 Netmaske</desc>
1130         </p-param>
1131         <p-param name="ipv6gateway">
1132             <desc>ipv6 gateway</desc>
1133         </p-param>
1134         <p-param name="ipv6dnsServerList">
1135             <desc>ipv6 dns server liste</desc>
1136         </p-param>
1137         <p-param name="vmPassword">
1138             <desc>Password for the virtual machine</desc>
1139         </p-param>
1140     </presentation>
1141 </workflow>