Advertisement
Guest User

Untitled

a guest
May 15th, 2023
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. 1. Azure Cloudshell -> Bash
  2. 2. Create cloud-init.yaml (with nano or whatever)
  3.  
  4. #cloud-config
  5. package_upgrade: true
  6.  
  7. packages:
  8. - docker.io
  9.  
  10. runcmd:
  11. - systemctl start docker
  12. - systemctl enable docker
  13. - docker run --detach --name watchtower --restart=on-failure --volume /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --label-enable --cleanup --interval 3600
  14. - docker run --detach --name archiveteam-warrior --label=com.centurylinklabs.watchtower.enable=true --restart=on-failure --publish 8001:8001 --env DOWNLOADER="highscore name" --env HTTP_USERNAME="xxx" --env HTTP_PASSWORD="yyy" --env SELECTED_PROJECT="auto" --env CONCURRENT_ITEMS="4" atdr.meo.ws/archiveteam/warrior-dockerfile
  15.  
  16.  
  17.  
  18.  
  19. 3. Create a bash script: create_vms.sh (Think of chmod +x create_vms.sh)
  20.  
  21. #!/bin/bash
  22.  
  23. # The number of VMs to be created
  24. num_vms=5
  25.  
  26. # The base for the name of the VMs
  27. vm_name_base="myVM"
  28.  
  29. # The ID of the subscription to use
  30. subscription_id="your-subscription-id"
  31.  
  32. # The username and password for the VMs
  33. username="xxx"
  34. password="yyy"
  35.  
  36. # Set the active subscription
  37. az account set --subscription $subscription_id
  38.  
  39. # Create a resource group
  40. az group create --name myResourceGroup --location westeurope
  41.  
  42. # Loop to create the VMs
  43. for ((i=1; i<=num_vms; i++)); do
  44. # Generate the VM name
  45. vm_name="${vm_name_base}${i}"
  46.  
  47. # Create the VM
  48. az vm create \
  49. --resource-group myResourceGroup \
  50. --name $vm_name \
  51. --image UbuntuLTS \
  52. --size Standard_B1ls \
  53. --admin-username $username \
  54. --admin-password $password \
  55. --custom-data cloud-init.yaml
  56.  
  57. # Open port 8001
  58. az vm open-port --port 8001 --resource-group myResourceGroup --name $vm_name
  59. done
  60.  
  61.  
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement