GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - devopsdevops30/ansible-playbooks: Ansible Playbook Samples for Azure

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

135 Commits
135 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
SIG_generalized_image
SIG_generalized_image
 
 
__helpers
__helpers
 
 
azure_rm_subnet
azure_rm_subnet
 
 
rest
rest
 
 
vmss
vmss
 
 
vmss_extension
vmss_extension
 
 
vmss_images
vmss_images
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
CODEGUIDELINE.md
CODEGUIDELINE.md
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
aci_create_with_acr.yml
aci_create_with_acr.yml
 
 
aks_create_scale.yml
aks_create_scale.yml
 
 
appgateway_create.yml
appgateway_create.yml
 
 
appserviceplan_scale.yml
appserviceplan_scale.yml
 
 
cosmosdb_create.yml
cosmosdb_create.yml
 
 
create_virtualmachine_with_subnet_in_different_resource_group.yml
create_virtualmachine_with_subnet_in_different_resource_group.yml
 
 
devtestlab-create.yml
devtestlab-create.yml
 
 
hdinsight_create.yml
hdinsight_create.yml
 
 
keyvault_create.yml
keyvault_create.yml
 
 
mysql_create.yml
mysql_create.yml
 
 
networkinterface_with_virtualnetwork_in_another_resource_group.yml
networkinterface_with_virtualnetwork_in_another_resource_group.yml
 
 
postgresql_create.yml
postgresql_create.yml
 
 
rediscache.yml
rediscache.yml
 
 
sql_create.yml
sql_create.yml
 
 
unlock-resources.yml
unlock-resources.yml
 
 
vm_create.yml
vm_create.yml
 
 
vm_create_existingvnet_deployjavaapp.yml
vm_create_existingvnet_deployjavaapp.yml
 
 
vm_create_image.yml
vm_create_image.yml
 
 
vm_create_ssh.yml
vm_create_ssh.yml
 
 
vm_create_windows.yml
vm_create_windows.yml
 
 
vm_create_with_nic_in_other_rg.yml
vm_create_with_nic_in_other_rg.yml
 
 
vnet_peering.yml
vnet_peering.yml
 
 
webapp.yml
webapp.yml
 
 

Repository files navigation

page_type sample
languages
yaml
products
azure
description Examples and best practices for building Ansible Playbooks for Azure

Travis CI

Ansible Playbooks for Azure

This repository contains examples and best practices for building Ansible Playbooks for Azure.

Prerequisites

  • Azure Account. If you don't have one, get a free one.

    To authenticate with Azure, generate service principal and expose them as environment variables or store them as a file.

  • Install Ansible

  • Install Azure dependencies package

    pip install ansible[azure]
  • Install azure_preview_modules role.

  • Install azure_preview_module role's dependencies packages.

    pip install -r ~/.ansible/roles/azure.azure_preview_modules/files/requirements-azure.txt

How to run

To run samples in your local environment,

  • git clone https://github.com/Azure-Samples/ansible-playbooks.git
  • cd ansible-playbooks
  • modify playbook to replace variables with yours, such as resource group name.
  • add Azure credential info by using one of the following options.

First option, set the following environment variables:

AZURE_CLIENT_ID=<service_principal_client_id>
AZURE_SECRET=<service_principal_password>
AZURE_SUBSCRIPTION_ID=<azure_subscription_id>
AZURE_TENANT=<azure_tenant_id>

Second option, add the following content to the file $HOME/.azure/credentials:

[default]
subscription_id=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
client_id=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
secret=xxxxxxxxxxxxxxxxx
tenant=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Third option, do a az login:

az login
  • ansible-playbook sample.yml

You also could develop your Ansible playbook and run it in Visual Studio Code.

Using Azure cloud shell in Visual Studio Code

Azure cloud shell automatically logs you in your azure subscription so you need not to do anything extra other than login to cluod shell and run the ansible-playbook command with -e switch to provide resource_group_name variable value.

To be able to run Cloud Shell in Visual Studio Code, you will need to install Azure Account Extension in VS Code.

After installing the Azure Account extension, Login to cloud shell in VS code and clone this repository. Upload the Ansible Playbook you want to run to cloud drive and run the following command (replace yourusernameincloudshell with your username value). Make sure you also replace the playbook name and corrosponding variable name expected by playbook.

ansible-playbook /home/yourusernameincloudshell/create_virtualmachine_with_subnet_in_different_resource_group.yml -e "resource_group_name=ansible_test_rg"

How to Contribute

Please refer to Coding Guideline on how to contribute.

Resources

Ansible on Azure

Get Started with Azure

Ansible Playbook

Ansible role azure_preview_modules

Ansible Galaxy for example roles from the Ansible community for deploying many popular applications.

License

MIT License

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Test

Sample playbooks in this repository are tested via travis CI, please see detail CI plan.

About

Ansible Playbook Samples for Azure

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.