From 0667dc13a5581ff34b97ee51007a0b80262eb037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C5=A1per=20Spagnolo?= Date: Thu, 20 Oct 2022 12:54:23 +0200 Subject: [PATCH] Update ansible --- ansible.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/ansible.md b/ansible.md index 6f38d61..d09c94b 100644 --- a/ansible.md +++ b/ansible.md @@ -12,3 +12,45 @@ fatal: [localhost]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_m ``` then issue this command: `ln -s /usr/bin/python3 /usr/bin/python`. + + +## Setup azure + +`sudo apt install azure-cli` + +`python3 -m venv ~/.venv-azure` + +`source ~/.venv-azure/bin/activate` + +`ansible-galaxy collection install azure.azcollection` + +`pip3 install "ansible[azure]"` (in venv preferably) + +Then go to Azure website and generate a new resource group. +Try to generate az command for that + +Then execute command: + +```bash +az ad sp create-for-rbac --name \ + --role Contributor \ + --scopes /subscriptions//resourceGroups/ +``` +to get the password. Other stuff can be fethced with `az account list`. + + +Now write these creds into file: +`$HOME/.azure/credentials` + +like so: +``` +[default] +subscription_id= (when you create group) +client_id= (appId in az ad) +secret= (az ad sp password) +tenant= (tennantId in both) +``` + +## Clear all pip packages + +`pip freeze | xargs pip uninstall -y`