Ansible repository with playbooks to manage azure objects
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
jdongmo 4ff4d80dd6 Add recipes to build azure infra. hace 5 años
files Add recipes to build azure infra. hace 5 años
inventory Add recipes to build azure infra. hace 5 años
roles Add recipes to build azure infra. hace 5 años
LICENSE first commit hace 5 años
Readme.md first commit hace 5 años
ansible.cfg Add recipes to build azure infra. hace 5 años
infra.yml Add recipes to build azure infra. hace 5 años
playbook_address_group.yml Add recipes to build azure infra. hace 5 años
playbook_analytics_workspace.yml Add recipes to build azure infra. hace 5 años
playbook_availability_set.yml Add recipes to build azure infra. hace 5 años
playbook_connect_vm_workspace.yml Add recipes to build azure infra. hace 5 años
playbook_ip.yml Add recipes to build azure infra. hace 5 años
playbook_load_balancer.yml Add recipes to build azure infra. hace 5 años
playbook_network_interface_card.yml Add recipes to build azure infra. hace 5 años
playbook_network_security_group.yml Add recipes to build azure infra. hace 5 años
playbook_peering.yml Add recipes to build azure infra. hace 5 años
playbook_resource_group.yml Add recipes to build azure infra. hace 5 años
playbook_route.yml Add recipes to build azure infra. hace 5 años
playbook_routing_table.yml Add recipes to build azure infra. hace 5 años
playbook_sentinel.yml Add recipes to build azure infra. hace 5 años
playbook_storage_account.yml Add recipes to build azure infra. hace 5 años
playbook_subnet.yml Add recipes to build azure infra. hace 5 años
playbook_virtual_machine.yml Add recipes to build azure infra. hace 5 años
playbook_virtual_network.yml Add recipes to build azure infra. hace 5 años
run.sh Add recipes to build azure infra. hace 5 años

Readme.md

Devops

Ansible repository to perform automatic tasks in Azure cloud.

Requirements

To run Azure recipe, you should have Azure variable (credentials and location) set in environment or having vault file with authentication variables

The host running plays must have python3 installed and library in requirements.txt file

yum install python3-pip

or

apt install python3-pip

Then install required libraries

pip3 install -r requirements.txt --user

The host must also have following packages:

  • sshpass
  • azure-cli
yum install sshpass azure-cli

or

apt install sshpass azure-cli

Give azure credentials in environment variables or with az command or using an encrypted vault file _creds.yml

---
azure_subscription_id: 5fc52367-fb6a-483d-a5ee-c1f218fa0dss
#Connect using AD account
azure_ad_user: user@domain.tld
azure_password: **************
#Connect using service principal
azure_client_id: a747fc62-38fa-453d-a5fa-ab3039a464cc
azure_secret: *******************************
azure_tenant: 893d20a5-1b00-47ed-9370-10f37cbf5t8a
...

And encrypt it with ansible-vault

example:
ansible-vault encrypt --vault-password-file  ~/.ssh/creds/vault_password.txt inventory/group_vars/jumpboxes/_creds.yml

Run

To run a playbook, we’ll use wrapper script run.sh To run default infrastructure playbook infra.yml who create all the infra

./run.sh -v

To run another playbook playbook.yml after default playbook

./run.sh -v playbook.yml

To only play another playbook playbook.yml

ANSIBLE_PLAYBOOK_FILE=playbook.yml ./run.sh -v

To only play another playbook (playbook.yml) against specific host host

ANSIBLE_PLAYBOOK_FILE=playbook.yml ./run.sh -v --limit host

Docker

We have a Dockerfile in order to generate a docker image to use it for running play in an controled environment.

  • Build image: docker build -t devops-docker .
  • Run a play using this image:
docker run -e -e "ANSIBLE_PLAYBOOK_FILE=playbook.yml" --entrypoint "./run.sh"
devops-docker -v --limit host