From c366c7c6fe06e09f1be5389006c03d17db722d5d Mon Sep 17 00:00:00 2001 From: Default User Date: Sun, 12 Nov 2023 18:18:52 +1300 Subject: [PATCH] #33 Added Add Network/Disk steps for *nix workers --- README.md | 15 +- ...tor-on-ESX-with-macOS-or-Linux-Worker.html | 496 ++++++++++++++ ...sk-on-ESXi-with-macOS-or-Linux-Worker.html | 7 - ...l-Machine-on-ESXi-with-Windows-Worker.html | 7 + ...ne-on-ESXi-with-macOS-or-Linux-Worker.html | 644 ++++++++++++++++++ docs/index.html | 65 +- .../metadata.json | 8 +- .../README.md | 2 - .../metadata.json | 2 +- .../script.txt | 4 +- .../metadata.json | 4 +- .../README.md | 1 - .../metadata.json | 2 +- .../script.txt | 2 + .../metadata.json | 24 + .../README.md | 1 + .../metadata.json | 12 + .../script.txt | 20 + 18 files changed, 1265 insertions(+), 51 deletions(-) create mode 100644 docs/Add-New-Network-Adaptor-on-ESX-with-macOS-or-Linux-Worker.html create mode 100644 docs/Power-Off/On-Virtual-Machine-on-ESXi-with-macOS-or-Linux-Worker.html rename steps/{addnewnetworkadaptoronesxiwithmacosorlinuxworker => addnewnetworkadaptoronesxwithmacosorlinuxworker}/metadata.json (53%) delete mode 100644 steps/addnewvirtualdiskwithmacosorlinuxworker/README.md create mode 100644 steps/poweroffonvirtualmachineonesxiwithmacosorlinuxworker/metadata.json create mode 100644 steps/poweroffvmwithmacosorlinuxworker/README.md create mode 100644 steps/poweroffvmwithmacosorlinuxworker/metadata.json create mode 100644 steps/poweroffvmwithmacosorlinuxworker/script.txt diff --git a/README.md b/README.md index a72f112..3ab6939 100644 --- a/README.md +++ b/README.md @@ -54,15 +54,9 @@ This Project contains the following Blueprints. -### Add New Network Adaptor on ESXi with macOS or Linux Worker - - ### Add New Network Adaptor on ESX with Windows Worker -### Add New Virtual Disk on ESXi with macOS or Linux Worker - - ### Add New Virtual Disk on ESXi with Windows Worker @@ -102,10 +96,19 @@ This Project contains the following Blueprints. ### Perform Test if VMWare Drivers Installed on Windows +### Power Off/On Virtual Machine on ESXi with macOS or Linux Worker + + ### Setup VMWare Tools on Windows Post Windows install setup of VMWare tools for new VM Windows node. +### Add New Network Adaptor on ESX with macOS or Linux Worker + + +### Add New Virtual Disk on ESXi with macOS or Linux Worker + + diff --git a/docs/Add-New-Network-Adaptor-on-ESX-with-macOS-or-Linux-Worker.html b/docs/Add-New-Network-Adaptor-on-ESX-with-macOS-or-Linux-Worker.html new file mode 100644 index 0000000..134d48c --- /dev/null +++ b/docs/Add-New-Network-Adaptor-on-ESX-with-macOS-or-Linux-Worker.html @@ -0,0 +1,496 @@ + + + + + + + + + How to Add New Network Adaptor on ESX with macOS or Linux Worker - Attune Automation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+
+ +
+
+ + + +
+ +
+
+

+ How to Add New Network Adaptor on ESX with macOS or Linux Worker +

+
+
+ + +
+
+
+ This documentation is generated by + + Attune + +
+
+ +
+
+
+ +
+
+
+ + + + + + + +
+
+ + +
+

+ Automate This +

+

+ Use the Attune GUI for your Scripts +

+

+

    + + 1 + Download Attune + + +
+
    + + 2 + Copy the Attune Project URL + + +
+
    + + 3 + Clone the Project in Attune + + +
+
    + + 4 + Plan your Job(s) + + +
+
    + + 5 + Run your Job(s) + + +
+

+

+ You've automated: Add New Network Adaptor on ESX with macOS or Linux Worker +

+
+
+

+ Get the most out of automation with our get started + videos, product demonstrations, and more. +

+

+ + Learn Attune Automation + +

+
+
+ +
+

The following steps will guide you through the manual process.

+
+ + + + + + + + + + +
+
+

+

PowerCLI reference is available at : +https://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.powercli.cmdletref.doc%2FNew-VM.html

+

+
+
+ + + + + + + + + + +
+

+ Connect via ssh: +

+
+
+ +ssh {automationworkerlinuxuser}@{automationworkerlinuxnode} + +
+ + + + + + + +
+

+ Execute the following script: +

+
+
+
+
+                
+# Delete the VM if it exists
+
+pwsh <<'EOF'
+$ErrorActionPreference = "Stop"
+Import-Module VMware.VimAutomation.Core
+
+Connect-VIServer {vmwareVcenterServer.ip} `
+    -User {vmwareVcenterUser.user} `
+    -Password {vmwareVcenterUser.password}
+
+$existing = Get-VM "{newVmNode.fqn}"
+
+New-NetworkAdapter -VM $existing -NetworkName "{ksVmwareNetworkName.value}" -type vmxnet3 -StartConnected
+
+EOF
+                
+            
+
+
+ + + + + + +
+
+

Completed

+

+ You have completed this instruction. +

+
+
+
+
+ + + +
+
+
+
+ Attune - Powered by ServerTribe +

+ Automate with Attune +

+

+ Download the Attune Community Edition. +

+

+ + DOWNLOAD!!! + +

+
+
+
+
+ +
+ + + +
+
+

+ Discuss this Project in Discord +

+

+ + Join our Discord channel and connect with like-minded individuals who + share your passion. Engage in lively discussions, gain valuable insights, + and stay updated on the latest trends in our industry. Don't miss out on + this opportunity to network, learn, and grow together. +

+
+
+

+ Click the link below and become a part of our vibrant community on + Discord today! +

+

+ + Join NOW!!! + +

+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + diff --git a/docs/Add-New-Virtual-Disk-on-ESXi-with-macOS-or-Linux-Worker.html b/docs/Add-New-Virtual-Disk-on-ESXi-with-macOS-or-Linux-Worker.html index f563ef3..a5a6acf 100644 --- a/docs/Add-New-Virtual-Disk-on-ESXi-with-macOS-or-Linux-Worker.html +++ b/docs/Add-New-Virtual-Disk-on-ESXi-with-macOS-or-Linux-Worker.html @@ -308,13 +308,6 @@

-
-
-

-

Adds a new virtual disk.

-

-
-
diff --git a/docs/Build-Virtual-Machine-on-ESXi-with-Windows-Worker.html b/docs/Build-Virtual-Machine-on-ESXi-with-Windows-Worker.html index 1b7e559..a5f95da 100644 --- a/docs/Build-Virtual-Machine-on-ESXi-with-Windows-Worker.html +++ b/docs/Build-Virtual-Machine-on-ESXi-with-Windows-Worker.html @@ -1165,6 +1165,13 @@

+
+
+

+ +

+
+
diff --git a/docs/Power-Off/On-Virtual-Machine-on-ESXi-with-macOS-or-Linux-Worker.html b/docs/Power-Off/On-Virtual-Machine-on-ESXi-with-macOS-or-Linux-Worker.html new file mode 100644 index 0000000..c0a84e3 --- /dev/null +++ b/docs/Power-Off/On-Virtual-Machine-on-ESXi-with-macOS-or-Linux-Worker.html @@ -0,0 +1,644 @@ + + + + + + + + + How to Power Off/On Virtual Machine on ESXi with macOS or Linux Worker - Attune Automation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+
+ +
+
+ + + +
+ +
+
+

+ How to Power Off/On Virtual Machine on ESXi with macOS or Linux Worker +

+
+
+ + +
+
+
+ This documentation is generated by + + Attune + +
+
+ +
+
+
+ +
+
+
+ + + + + + + +
+
+ + +
+

+ Automate This +

+

+ Use the Attune GUI for your Scripts +

+

+

    + + 1 + Download Attune + + +
+
    + + 2 + Copy the Attune Project URL + + +
+
    + + 3 + Clone the Project in Attune + + +
+
    + + 4 + Plan your Job(s) + + +
+
    + + 5 + Run your Job(s) + + +
+

+

+ You've automated: Power Off/On Virtual Machine on ESXi with macOS or Linux Worker +

+
+
+

+ Get the most out of automation with our get started + videos, product demonstrations, and more. +

+

+ + Learn Attune Automation + +

+
+
+ +
+

The following steps will guide you through the manual process.

+
+ + + + + + + + + + +
+
+

+

Sets PowerShell CLI options.

+

+
+
+ + + + + + + + + + +
+

+ Connect via ssh: +

+
+
+ +ssh {automationworkerlinuxuser}@{automationworkerlinuxnode} + +
+ + + + + + + +
+

+ Execute the following script: +

+
+
+
+
+                
+pwsh <<'EOF'
+$ErrorActionPreference = "Stop"
+Import-Module VMware.VimAutomation.Core
+Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false -Confirm:$false
+Set-PowerCLIConfiguration -InvalidCertificateAction ignore -Confirm:$false
+EOF
+                
+            
+
+
+ + + + + + + + + + + +
+
+

+

Power Off a ESXi virtual machine given it's fully qualified domain name.

+

+
+
+ + + + + + + + + + + + + + + + +
+

+ Execute the following script: +

+
+
+
+
+                
+# Power Off the VM
+
+pwsh <<'EOF'
+$ErrorActionPreference = "Stop"
+Import-Module VMware.VimAutomation.Core
+
+Connect-VIServer {vmwareVcenterNode.ip} `
+    -User "{vmwareVcenterUser.user}" `
+    -Password "{vmwareVcenterUser.password}"
+
+if ($? -eq $false) {
+    Write-Host "Error: Not connected."
+    exit 1
+}
+
+$existing = Get-VM "{newVmNode.fqn}"
+Get-VM "{newVmNode.fqn}" | Stop-VM -Confirm:$false
+
+
+EOF
+                
+            
+
+
+ + + + + + + + + + + +
+
+

+

Boot the target Windows virtual machine up. It will kickstart from the CD-ROM.

+

+
+
+ + + + + + + + + + + + + + + + +
+

+ Execute the following script: +

+
+
+
+
+                
+pwsh <<'EOF'
+$ErrorActionPreference = "Stop"
+Import-Module VMware.VimAutomation.Core
+
+Connect-VIServer {vmwareVcenterNode.ip} `
+    -User "{vmwareVcenterUser.user}" `
+    -Password '{vmwareVcenterUser.password}'
+
+if ($? -eq $false) {
+    Write-Host "Error: Not connected."
+    exit 1
+}
+
+Start-VM -VM (Get-VM -Name "{newVmNode.fqn}") -RunAsync
+
+EOF
+                
+            
+
+
+ + + + + + +
+
+

Completed

+

+ You have completed this instruction. +

+
+
+
+
+ + + +
+
+
+
+ Attune - Powered by ServerTribe +

+ Automate with Attune +

+

+ Download the Attune Community Edition. +

+

+ + DOWNLOAD!!! + +

+
+
+
+
+ +
+ + + +
+
+

+ Discuss this Project in Discord +

+

+ + Join our Discord channel and connect with like-minded individuals who + share your passion. Engage in lively discussions, gain valuable insights, + and stay updated on the latest trends in our industry. Don't miss out on + this opportunity to network, learn, and grow together. +

+
+
+

+ Click the link below and become a part of our vibrant community on + Discord today! +

+

+ + Join NOW!!! + +

+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + diff --git a/docs/index.html b/docs/index.html index 4c5cd72..b8469a3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -175,19 +175,6 @@
+ + + + diff --git a/steps/addnewnetworkadaptoronesxiwithmacosorlinuxworker/metadata.json b/steps/addnewnetworkadaptoronesxwithmacosorlinuxworker/metadata.json similarity index 53% rename from steps/addnewnetworkadaptoronesxiwithmacosorlinuxworker/metadata.json rename to steps/addnewnetworkadaptoronesxwithmacosorlinuxworker/metadata.json index a912217..ff1fa4f 100644 --- a/steps/addnewnetworkadaptoronesxiwithmacosorlinuxworker/metadata.json +++ b/steps/addnewnetworkadaptoronesxwithmacosorlinuxworker/metadata.json @@ -1,16 +1,16 @@ { - "actionOnStepFail": null, + "actionOnStepFail": "stop", "concurrency": 1, "enabled": true, - "externalUuid4": "b2332ce3-d9e5-421c-bd6d-b3e188e3464e", + "externalUuid4": "e25dcc86-9826-4c40-9578-88a5f68414bf", "isBlueprint": true, - "key": "addnewnetworkadaptoronesxiwithmacosorlinuxworker", + "key": "addnewnetworkadaptoronesxwithmacosorlinuxworker", "links": [ { "order": 0, "stepKey": "addnewnetworkadaptorwithmacosorlinuxworker" } ], - "name": "Add New Network Adaptor on ESXi with macOS or Linux Worker", + "name": "Add New Network Adaptor on ESX with macOS or Linux Worker", "type": "com.servertribe.attune.tuples.StepGroupTuple" } \ No newline at end of file diff --git a/steps/addnewnetworkadaptorwithmacosorlinuxworker/README.md b/steps/addnewnetworkadaptorwithmacosorlinuxworker/README.md index 62b683e..540e31a 100644 --- a/steps/addnewnetworkadaptorwithmacosorlinuxworker/README.md +++ b/steps/addnewnetworkadaptorwithmacosorlinuxworker/README.md @@ -1,4 +1,2 @@ -Add network adapter - PowerCLI reference is available at : https://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.powercli.cmdletref.doc%2FNew-VM.html \ No newline at end of file diff --git a/steps/addnewnetworkadaptorwithmacosorlinuxworker/metadata.json b/steps/addnewnetworkadaptorwithmacosorlinuxworker/metadata.json index 2936c80..b5acae7 100644 --- a/steps/addnewnetworkadaptorwithmacosorlinuxworker/metadata.json +++ b/steps/addnewnetworkadaptorwithmacosorlinuxworker/metadata.json @@ -1,7 +1,7 @@ { "actionOnStepFail": null, "enabled": true, - "externalUuid4": "fb8dd2da-628a-48ae-a876-01ed45ef335f", + "externalUuid4": "202c7a37-e425-41e4-883f-1cf0d0cd001c", "interpreter": 1, "key": "addnewnetworkadaptorwithmacosorlinuxworker", "name": "Add New Network Adaptor with macOS or Linux Worker", diff --git a/steps/addnewnetworkadaptorwithmacosorlinuxworker/script.txt b/steps/addnewnetworkadaptorwithmacosorlinuxworker/script.txt index d73d398..5240b9a 100644 --- a/steps/addnewnetworkadaptorwithmacosorlinuxworker/script.txt +++ b/steps/addnewnetworkadaptorwithmacosorlinuxworker/script.txt @@ -1,3 +1,5 @@ +# Delete the VM if it exists + pwsh <<'EOF' $ErrorActionPreference = "Stop" Import-Module VMware.VimAutomation.Core @@ -8,6 +10,6 @@ Connect-VIServer {vmwareVcenterServer.ip} ` $existing = Get-VM "{newVmNode.fqn}" -New-NetworkAdapter -VM $existing -NetworkName "{vmNetworkName.value}" -type vmxnet3 -StartConnected +New-NetworkAdapter -VM $existing -NetworkName "{ksVmwareNetworkName.value}" -type vmxnet3 -StartConnected EOF diff --git a/steps/addnewvirtualdiskonesxiwithmacosorlinuxworker/metadata.json b/steps/addnewvirtualdiskonesxiwithmacosorlinuxworker/metadata.json index 6596381..c8e63ce 100644 --- a/steps/addnewvirtualdiskonesxiwithmacosorlinuxworker/metadata.json +++ b/steps/addnewvirtualdiskonesxiwithmacosorlinuxworker/metadata.json @@ -1,8 +1,8 @@ { - "actionOnStepFail": null, + "actionOnStepFail": "stop", "concurrency": 1, "enabled": true, - "externalUuid4": "5669a03d-85fe-4f3e-8b95-da02cfc998dc", + "externalUuid4": "09722734-8bd5-483a-ae6e-940690443e53", "isBlueprint": true, "key": "addnewvirtualdiskonesxiwithmacosorlinuxworker", "links": [ diff --git a/steps/addnewvirtualdiskwithmacosorlinuxworker/README.md b/steps/addnewvirtualdiskwithmacosorlinuxworker/README.md deleted file mode 100644 index 9fbc4e6..0000000 --- a/steps/addnewvirtualdiskwithmacosorlinuxworker/README.md +++ /dev/null @@ -1 +0,0 @@ -Adds a new virtual disk. \ No newline at end of file diff --git a/steps/addnewvirtualdiskwithmacosorlinuxworker/metadata.json b/steps/addnewvirtualdiskwithmacosorlinuxworker/metadata.json index fbb8899..4f9fdb4 100644 --- a/steps/addnewvirtualdiskwithmacosorlinuxworker/metadata.json +++ b/steps/addnewvirtualdiskwithmacosorlinuxworker/metadata.json @@ -1,7 +1,7 @@ { "actionOnStepFail": null, "enabled": true, - "externalUuid4": "eef5e85e-6f4c-4ebd-93f0-e3b611299405", + "externalUuid4": "7884b535-36b3-435d-a1b5-dfacb5dc048d", "interpreter": 1, "key": "addnewvirtualdiskwithmacosorlinuxworker", "name": "Add New Virtual Disk with macOS or Linux Worker", diff --git a/steps/addnewvirtualdiskwithmacosorlinuxworker/script.txt b/steps/addnewvirtualdiskwithmacosorlinuxworker/script.txt index 89c04ef..78e5b89 100644 --- a/steps/addnewvirtualdiskwithmacosorlinuxworker/script.txt +++ b/steps/addnewvirtualdiskwithmacosorlinuxworker/script.txt @@ -1,3 +1,5 @@ + + pwsh <<'EOF' $ErrorActionPreference = "Stop" Import-Module VMware.VimAutomation.Core diff --git a/steps/poweroffonvirtualmachineonesxiwithmacosorlinuxworker/metadata.json b/steps/poweroffonvirtualmachineonesxiwithmacosorlinuxworker/metadata.json new file mode 100644 index 0000000..7cb83a6 --- /dev/null +++ b/steps/poweroffonvirtualmachineonesxiwithmacosorlinuxworker/metadata.json @@ -0,0 +1,24 @@ +{ + "actionOnStepFail": "stop", + "concurrency": 1, + "enabled": true, + "externalUuid4": "80ab2e3a-c1e2-4aef-9acf-4f7832e70856", + "isBlueprint": true, + "key": "poweroffonvirtualmachineonesxiwithmacosorlinuxworker", + "links": [ + { + "order": 50, + "stepKey": "setpowerclioptionswithmacosorlinuxworker" + }, + { + "order": 150, + "stepKey": "poweroffvmwithmacosorlinuxworker" + }, + { + "order": 1050, + "stepKey": "startvmwithmacosorlinuxworker" + } + ], + "name": "Power Off/On Virtual Machine on ESXi with macOS or Linux Worker", + "type": "com.servertribe.attune.tuples.StepGroupTuple" +} \ No newline at end of file diff --git a/steps/poweroffvmwithmacosorlinuxworker/README.md b/steps/poweroffvmwithmacosorlinuxworker/README.md new file mode 100644 index 0000000..1f7db65 --- /dev/null +++ b/steps/poweroffvmwithmacosorlinuxworker/README.md @@ -0,0 +1 @@ +Power Off a ESXi virtual machine given it's fully qualified domain name. \ No newline at end of file diff --git a/steps/poweroffvmwithmacosorlinuxworker/metadata.json b/steps/poweroffvmwithmacosorlinuxworker/metadata.json new file mode 100644 index 0000000..3e1e8df --- /dev/null +++ b/steps/poweroffvmwithmacosorlinuxworker/metadata.json @@ -0,0 +1,12 @@ +{ + "actionOnStepFail": "stop", + "enabled": true, + "externalUuid4": "c0a71540-317f-429f-b509-6621485853c3", + "interpreter": 1, + "key": "poweroffvmwithmacosorlinuxworker", + "name": "Power Off VM with macOS or Linux Worker", + "osCredKey": "automationworkerlinuxuser", + "serverKey": "automationworkerlinuxnode", + "successExitCode": 0, + "type": "com.servertribe.attune.tuples.StepSshTuple" +} \ No newline at end of file diff --git a/steps/poweroffvmwithmacosorlinuxworker/script.txt b/steps/poweroffvmwithmacosorlinuxworker/script.txt new file mode 100644 index 0000000..cd61cd6 --- /dev/null +++ b/steps/poweroffvmwithmacosorlinuxworker/script.txt @@ -0,0 +1,20 @@ +# Power Off the VM + +pwsh <<'EOF' +$ErrorActionPreference = "Stop" +Import-Module VMware.VimAutomation.Core + +Connect-VIServer {vmwareVcenterNode.ip} ` + -User "{vmwareVcenterUser.user}" ` + -Password "{vmwareVcenterUser.password}" + +if ($? -eq $false) { + Write-Host "Error: Not connected." + exit 1 +} + +$existing = Get-VM "{newVmNode.fqn}" +Get-VM "{newVmNode.fqn}" | Stop-VM -Confirm:$false + + +EOF