Hands on DevSecOps Coaching that is provided on AWS and Azure Cloud platforms. Contact Coach AK at devops.coaching@gmail.com for more info. You can also reach out to Coach AK at +1(469) 733-5248
Tuesday, August 29, 2023
Thursday, August 24, 2023
Install Ansible on Red Hat Linux | How to setup Ansible on Red Hat Linux VM | Ansible install on Azure Linux Virtual Machine | Ansible Azure Integration
How to setup Ansible on Red Hat Linux VM and Integrate with Azure Cloud?
Ansible is #1 configuration management tool. It can also be used for infrastructure provisioning as well. or You can use Ansible in combination of Terraform which can take care of infra automation and Ansible can do configuration management. We will be setting up Ansible on Red Hat VM in Azure cloud And create some resources in Azure Cloud by using Ansible playbooks.
- Create new Red Hat VM in Azure Cloud for setting up Ansible, just open port 22 in firewall rule.
- Install Azure CLI on Red Hat Linus VM
- Service principal to create any resources in Azure cloud using Azure CLI
sudo hostnamectl set-hostname AnsibleMgmtNode
sudo yum update -y
To configure Azure credentials, you need the following information:
- Your Azure subscription ID and tenant ID
- The service principal application ID and secret
Create an Azure Service Principal
Configure the Ansible credentials using one of the following techniques:
Option 1: Create Ansible credentials file
In this section, you create a local credentials file to provide credentials to Ansible. For security reasons, credential files should only be used in development environments.
mkdir ~/.azure
vi ~/.azure/credentials
Option 2: Define Ansible environment variables
On the host virtual machine, export the service principal values to configure your Ansible credentials.
export AZURE_SUBSCRIPTION_ID=<subscription_id> export AZURE_CLIENT_ID=<service_principal_app_id> export AZURE_SECRET=<service_principal_password> export AZURE_TENANT=<service_principal_tenant_id>
Test Ansible installation
You now have a virtual machine with Ansible installed and configured!
This section shows how to create a test resource group within your new Ansible configuration. If you don't need to do that, you can skip this section.
Option 1: Use an ad-hoc ansible command
Run the following ad-hoc Ansible command to create a resource group:
ansible localhost -m azure_rm_resourcegroup -a "name=my-rg123 location=eastus"
Option 2: Write and run an Ansible playbook
Create a simple playbook to create resource group in Azure.
sudo vi create-rg.yml
---
- hosts: localhost
connection: local
tasks:
- name: Creating resource group
azure_rm_resourcegroup:
name: "myResourceGroup"
location: "eastus"
Execute the playbook using ansible-playbook command.
ansible-playbook create-rg.yml
sudo vi delete-rg.yml
--- - hosts: localhost tasks: - name: Deleting resource group - "{{ name }}" azure_rm_resourcegroup: name: "{{ name }}" state: absent register: rg - debug: var: rg
ansible-playbook delete-rg.yml --extra-vars "name=myResourceGroup"
Wednesday, August 23, 2023
Automate Azure cloud infrastructure setup using Ansible and Azure DevOps pipeline | How to integrate Ansible with Azure DevOps | Integrating Ansible with Azure DevOps Pipelines |
To configure Azure credentials, you need the following information:
- Your Azure subscription ID and tenant ID
- The service principal application ID and secret
Pre-requisites:
- Azure account subscription, click here if you don't have one.
- Azure CLI needs to be installed.
- Service principal to create any resources in Azure cloud using Azure cloud shell or Azure CLI
Login to Azure
Enter Microsoft credentials
Create Azure Service Principal
Create a simple playbook to create a resource group in Azure. Make sure you modify the name of the resource group and location below.
---
- hosts: localhost
connection: local
tasks:
- name: Creating resource group
azure_rm_resourcegroup:
name: "my-rg12"
location: "eastus"
Login to Azure Devops --> https://dev.azure.com
Select project dashboard.
Go to Pipelines -> New pipeline --> Click on Azure Repos Git or any SCM where you have playbooks stored. Select repo, click on Starter pipeline.
- Install Ansible on build agent
- Install Ansible rm module on build agent
- Execute Ansible playbook for creating resource group in Azure cloud.
Tuesday, August 22, 2023
Install Azure CLI in Red Hat Linux | How to setup Azure CLI in Linux | How to Install Azure CLI in Red Hat Enterprise Linux
The Azure command-line interface (Azure CLI) is a set of commands used to create and manage Azure resources. The Azure CLI is available across Azure services and is designed to get you working quickly with Azure, with an emphasis on automation. Azure CLI is Microsoft's cross-platform command-line experience for managing Azure resources.
Azure CLI can be installed by following below steps:
Import the Microsoft repository key
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
For RHEL 8 or CentOS Stream 8, add packages-microsoft-com-prod repository:
sudo dnf install -y https://packages.microsoft.com/config/rhel/8/packages-microsoft-prod.rpm
Check the version of Azure CLI
az login
How to create Red Hat Linux Virtual Machine (VM) in Azure? | Create Red Hat Linux VM in Azure | How to connect to Azure VM from your local machine
How to Create Red Hat Linux Virtual Machines(VM) in Azure Cloud?
Creating Virtual Machine is easy and straight forward in Azure Cloud. Let us see how to do that in Azure portal.
Watch Steps in YouTube channel:
Pre-requisites:
- Azure account subscription, click here if you don't have one.
- SSH client such as Git bash, putty or iTerm(mac os)
7. Under Networking
Monday, August 21, 2023
Install Ansible on Ubuntu | How to setup Ansible on Azure Ubuntu 22.0.4 instance | Ansible install on Azure Ubuntu Virtual Machine
sudo hostnamectl set-hostname AnsibleMgmtNode
sudo apt-get update
Saturday, August 19, 2023
How to connect to Azure Virtual Machine from your local machine? | Connect to Azure VM from your local machine | Connect to Azure VM from your local machine
Let's learn how to connect to a Virtual machine running in Azure cloud from your local machine. Your local machine can be a Windows laptop or MacBook laptop.
1. Keys(for e.g., yourkey.pem) already downloaded in your local machine, preferably in downloads folder.
2. Azure VM is up and running
3. SSH client - for Windows laptop, you need to install an SSH client such as Git bash or putty. You can download Git from this URL - https://git-scm.com/downloads. For Apple laptop you need to download iTerm from here.
Steps to connect to your Azure VM instance:
1. Go to Azure console --> https://portal.azure.com
4. copy the values from step # 4
5. Go to your local machine, Open Git Bash in Windows
type below commands:
Now copy the value from Example in the above screen
and then execute below command to make sure the keys have only read permissions.
What is GitHub Advanced Security for Azure DevOps | Configure GitHub Advanced Security for Azure DevOps
GitHub Advanced Security for Azure DevOps brings the secret scanning, dependency scanning and CodeQL code scanning solutions already ava...
-
Let us learn how to create and configure a Self-Hosted Agent in Azure DevOps (ADO). What is an Agent? An agent is computing infrastructure w...
-
(More New Topics..New CICD tool GitHub Actions, Helm included !! ) Here is the coaching model: Total 10 weeks of coaching program 2 sess...
-
What is Amazon EKS Amazon EKS is a fully managed container orchestration service. EKS allows you to quickly deploy a production ready Kubern...