Test the tooling and processes my team is using to deploy application in an OpenStack region to Azure. This test will bake, test, deploy and form a Consul cluster in Azure.
- Packer
- Ansible
- Terraform
An Azure subscription.
azure config mode arm
azure login
NOTE: If you have multiple subscription/account, make sure you are working on the correct subscription by running the following;
azure account list
azure account set <AZURE_SUBSCRIPTION>
3a. Create an application
azure ad app create --name "azurefest" --home-page "http://azurefest.demo.net" --identifier-uris "http://azurefest.demo.net" --password <password>
The home-page
and identifier-uris
are required but you can assign any non-existent url.
3b. Create service principal for the application that you created above using its ApplicationId (AppId above)
azure ad sp create <AppId>
get the comes from the previous step (3a)
3c. Create role assignment for the service principal (SP)
azure role assignment create --objectId <ObjectId> -o Owner -c /subscriptions/<AZURE_SUBSCRIPTION>
get the from the previous step (3b)
export ARM_SUBSCRIPTION_ID=<your_ARM_subscription_id>
export ARM_CLIENT_SECRET=<password>
export ARM_TENANT_ID=<your_ARM_tenant_ID>
export ARM_CLIENT_ID=<your_ARM_client_ID>
cd infra/terraform/pre-tasks
terraform plan
teraraform apply
export ARM_RESOURCE_GROUP=azurefest-sed-rg
export ARM_STORAGE_ACCOUNT=azurefestpersistentsa
cd ../../consul
ansible-galaxy install --role-file=ansible/requirements.yml --roles-path=ansible/roles --force
cd packer
packer build packer.json
Take note of the image id/name created by packer, example: consul-osDisk.ee6c4f8c-27ad-415e-b915-f3fa9df5c9b2.vhd
Create/Update the main terraform.tf with the image id/name of the baked image and other Azure resource information created from the terraform pre-tasks. One of the Consul public IP address creted from the pre-tasks is needed by terraform to remotely run consul join command
.
cd ../../terraform/
terraform plan
terraform apply
ssh -i ~/.ssh/id_rsa [email protected] '/opt/consul/bin/consul members'
The IP address 13.92.36.55
is from the terraform pre-tasks.
NOTE:
Delete the Azure resource group named azurefest-sed-rg
before running this exercise.
Changing the image id/name will not rebuild the nodes, you have to taint the nodes manually to rebuild them.
https://resources.azure.com/
http://storageexplorer.com/
Roel Brutas
[email protected]