Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Azure Cloudshell -> Bash
- 2. Create cloud-init.yaml (with nano or whatever)
- #cloud-config
- package_upgrade: true
- packages:
- - docker.io
- runcmd:
- - systemctl start docker
- - systemctl enable docker
- - docker run --detach --name watchtower --restart=on-failure --volume /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --label-enable --cleanup --interval 3600
- - 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
- 3. Create a bash script: create_vms.sh (Think of chmod +x create_vms.sh)
- #!/bin/bash
- # The number of VMs to be created
- num_vms=5
- # The base for the name of the VMs
- vm_name_base="myVM"
- # The ID of the subscription to use
- subscription_id="your-subscription-id"
- # The username and password for the VMs
- username="xxx"
- password="yyy"
- # Set the active subscription
- az account set --subscription $subscription_id
- # Create a resource group
- az group create --name myResourceGroup --location westeurope
- # Loop to create the VMs
- for ((i=1; i<=num_vms; i++)); do
- # Generate the VM name
- vm_name="${vm_name_base}${i}"
- # Create the VM
- az vm create \
- --resource-group myResourceGroup \
- --name $vm_name \
- --image UbuntuLTS \
- --size Standard_B1ls \
- --admin-username $username \
- --admin-password $password \
- --custom-data cloud-init.yaml
- # Open port 8001
- az vm open-port --port 8001 --resource-group myResourceGroup --name $vm_name
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement