Skip to content

Instantly share code, notes, and snippets.

@scottharwell
Last active December 14, 2023 15:13
Show Gist options
  • Save scottharwell/c5ed56a4d67e3a1fa5eadc4d92ab5434 to your computer and use it in GitHub Desktop.
Save scottharwell/c5ed56a4d67e3a1fa5eadc4d92ab5434 to your computer and use it in GitHub Desktop.
Example deploying Ansible Automation Platform as a Managed Application on Microsoft Azure using Fish shell
#!/usr/bin/env fish
set -x ANSIBLE_ACCESS_MODE "public";
set -x AZURE_DEPLOYMENT_SUBSCRIPTION "changeme";
set -x AZURE_APP_DEPLOYMENT_RESOURCE_GROUP "changeme";
set -x AZURE_APP_NAME "$ANSIBLE_ACCESS_MODE-deployment";
set -x AZURE_MANAGED_APP_RESOURCES_GROUP "mrg-$AZURE_APP_NAME";
set -x AZURE_REGION "eastus";
set -x AZURE_PUBLISHER "redhat";
set -x AZURE_OFFER "rhaapomsa";
set -x AZURE_PLAN "rh-aap-azure50pub-a1";
set -x AZURE_PLAN_VERSION "1.3.0";
set -x ANSIBLE_ADMIN_PASSWORD "changeme";
set -x VNET_CIDR "172.16.8.0/24";
set -x CLUSTER_CIDR "172.16.8.0/26";
set -x APP_GW_CIDR "172.16.8.64/28";
set -x PRIVATE_LINK_CIDR "172.16.8.96/28";
set -x DATABASE_CIDR "172.16.8.80/28";
set -x SERVICE_CIDR "172.16.9.0/26";
set -x DNS_SERVICE_IP "172.16.9.3";
set -x POD_CIDR "172.16.16.0/20";
set -x DISASTER_RECOVERY true;
az managedapp create \
-g $AZURE_APP_DEPLOYMENT_RESOURCE_GROUP \
-n $AZURE_APP_NAME \
-l $AZURE_REGION \
--kind MarketPlace \
-m "/subscriptions/$AZURE_DEPLOYMENT_SUBSCRIPTION/resourceGroups/$AZURE_MANAGED_APP_RESOURCES_GROUP" \
--plan-name $AZURE_PLAN \
--plan-version $AZURE_PLAN_VERSION \
--plan-product $AZURE_OFFER \
--plan-publisher $AZURE_PUBLISHER \
--parameters "{\"adminPassword\":{\"value\":\"$ANSIBLE_ADMIN_PASSWORD\"},\"crossTenantRoleAssignment\":{\"value\":true},\"disasterRecovery\":{\"value\":$DISASTER_RECOVERY},\"location\":{\"value\":\"$AZURE_REGION\"},\"access\":{\"value\":\"$ANSIBLE_ACCESS_MODE\"},\"vnetConfig\":{\"value\":{\"name\":\"vnet01\",\"resourceGroup\":\"$AZURE_MANAGED_APP_RESOURCES_GROUP\",\"addressPrefixes\":[\"$VNET_CIDR\"],\"addressPrefix\":\"$VNET_CIDR\",\"newOrExisting\":\"new\",\"subnets\":{\"aks\":{\"name\":\"cluster\",\"addressPrefix\":\"$CLUSTER_CIDR\"},\"appgw\":{\"name\":\"appgw\",\"addressPrefix\":\"$APP_GW_CIDR\"},\"plink\":{\"name\":\"private_link\",\"addressPrefix\":\"$PRIVATE_LINK_CIDR\"},\"postgres\":{\"name\":\"database\",\"addressPrefix\":\"$DATABASE_CIDR\"}}}},\"dnsServiceIP\":{\"value\":\"$DNS_SERVICE_IP\"},\"podCidr\":{\"value\":\"$POD_CIDR\"},\"serviceCidr\":{\"value\":\"$SERVICE_CIDR\"},\"tagsByResource\":{\"value\":{\"Microsoft.Network/applicationGateways\":{\"deployment\":\"cli\"},\"Microsoft.DBforPostgreSQL/flexibleServers\":{\"deployment\":\"cli\"},\"Microsoft.Resources/deploymentScripts\":{\"deployment\":\"cli\"},\"Microsoft.Network/dnsZones\":{\"deployment\":\"cli\"},\"Microsoft.KeyVault/vaults\":{\"deployment\":\"cli\"},\"Microsoft.ContainerService/managedClusters\":{\"deployment\":\"cli\"},\"Microsoft.OperationalInsights/workspaces\":{\"deployment\":\"cli\"},\"Microsoft.Solutions/applications\":{\"deployment\":\"cli\"},\"Microsoft.ManagedIdentity/userAssignedIdentities\":{\"deployment\":\"cli\"},\"Microsoft.Network/privateDnsZones/virtualNetworkLinks\":{\"deployment\":\"cli\"},\"Microsoft.Resources/resourceGroups\":{\"deployment\":\"cli\"},\"Microsoft.Network/privateDnsZones\":{\"deployment\":\"cli\"},\"Microsoft.Network/privateEndpoints\":{\"deployment\":\"cli\"},\"Microsoft.OperationsManagement/solutions\":{\"deployment\":\"cli\"},\"Microsoft.Storage/storageAccounts\":{\"deployment\":\"cli\"},\"Microsoft.Network/virtualNetworks\":{\"deployment\":\"cli\"}}}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment