alessandro-avila / project-oagents

Experimental AI Agents Framework
Creative Commons Attribution 4.0 International
0 stars 0 forks source link

Developer.Implement chain for #0 #78

Open project-oagent-gh-app[bot] opened 5 months ago

project-oagent-gh-app[bot] commented 5 months ago

{ 'code': "# Install Azure CLI curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Install .Net Core SDK

wget https://download.visualstudio.microsoft.com/download/pr/95e91e8e-496e-4f22-8d12-573aa5aa67f6/32cc5f113a3a10f6e6c4d8a4e2d6f203/dotnet-sdk-3.1.100-preview3-014645-linux-x64.tar.gz mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-3.1.100-preview3-014645-linux-x64.tar.gz -C $HOME/dotnet export DOTNET_ROOT=$HOME/dotnet export PATH=$PATH:$HOME/dotnet" }

project-oagent-gh-app[bot] commented 5 months ago

This bash script accomplishes the task of creating a resource group, creating a virtual machine, and installing Nginx via the cloud-init configuration. It also installs Azure CLI and .Net Core SDK.

#!/bin/bash

# Install Azure CLI
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

# Install .Net Core SDK
wget https://download.visualstudio.microsoft.com/download/pr/95e91e8e-496e-4f22-8d12-573aa5aa67f6/32cc5f113a3a10f6e6c4d8a4e2d6f203/dotnet-sdk-3.1.100-preview3-014645-linux-x64.tar.gz
mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-3.1.100-preview3-014645-linux-x64.tar.gz -C $HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet

# Create a cloud-init configuration file
echo "
#cloud-config
package_upgrade: true
packages:  
- nginx" > cloud-init.txt

# Create a resource group
az group create --name myResourceGroupAutomate --location eastus

# Create a virtual machine with the cloud-init configuration
az vm create \
--resource-group myResourceGroupAutomate \
--name myAutomatedVM \
--image UbuntuLTS \
--admin-username azureuser \
--generate-ssh-keys \
--custom-data cloud-init.txt

# Use the Azure CLI to deploy a custom script extension to the VM
az vm extension set \
--resource-group myResourceGroupAutomate \
--vm-name myAutomatedVM --name customScript \
--publisher Microsoft.Azure.Extensions \
--settings '{"commandToExecute": "apt-get install -y nginx"}'

This script first installs the Azure CLI and .Net Core SDK. Then it creates a cloud-init.txt file containing the cloud-init configuration which basically upgrades the packages in the virtual machine and installs Nginx. Afterwards, it uses the Azure CLI to create a resource group and a virtual machine in that resource group. It also uses the custom-data option to provide the cloud-init configuration to the VM. Finally, it uses the Azure CLI to deploy a custom script extension to the virtual machine that installs the Nginx webserver. So, after running this script, you will have a virtual machine with Nginx installed on it.