Ansible repository with playbooks to manage azure objects
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
jdongmo 0a62f29489 Clean inventory há 5 anos
files Add recipes to build azure infra. há 5 anos
inventory Clean inventory há 5 anos
roles Add recipes to build azure infra. há 5 anos
LICENSE first commit há 5 anos
Readme.md first commit há 5 anos
ansible.cfg Add recipes to build azure infra. há 5 anos
infra.yml Add recipes to build azure infra. há 5 anos
playbook_address_group.yml Add recipes to build azure infra. há 5 anos
playbook_analytics_workspace.yml Add recipes to build azure infra. há 5 anos
playbook_availability_set.yml Add recipes to build azure infra. há 5 anos
playbook_connect_vm_workspace.yml Add recipes to build azure infra. há 5 anos
playbook_ip.yml Add recipes to build azure infra. há 5 anos
playbook_load_balancer.yml Add recipes to build azure infra. há 5 anos
playbook_network_interface_card.yml Add recipes to build azure infra. há 5 anos
playbook_network_security_group.yml Add recipes to build azure infra. há 5 anos
playbook_peering.yml Add recipes to build azure infra. há 5 anos
playbook_resource_group.yml Add recipes to build azure infra. há 5 anos
playbook_route.yml Add recipes to build azure infra. há 5 anos
playbook_routing_table.yml Add recipes to build azure infra. há 5 anos
playbook_sentinel.yml Add recipes to build azure infra. há 5 anos
playbook_storage_account.yml Add recipes to build azure infra. há 5 anos
playbook_subnet.yml Add recipes to build azure infra. há 5 anos
playbook_virtual_machine.yml Add recipes to build azure infra. há 5 anos
playbook_virtual_network.yml Add recipes to build azure infra. há 5 anos
run.sh Add recipes to build azure infra. há 5 anos

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