Skip to content

Latest commit

 

History

History
88 lines (67 loc) · 2.8 KB

ansible.md

File metadata and controls

88 lines (67 loc) · 2.8 KB

Using Azure Resource Manager modules for Ansible

It's demo time! Please note that the directory containing the Ansible Vault is not shared, but all the public variables are. They are also properly named, so you can easily create your own vault with your secret variables.

Test Login to Azure

Show the demo/login.yml playbook, and explain the steps.

ssh-copy-id localhost # When prompted, enter your password
mkvirtualenv ansiblecopenhagenmeetup02 --python=python2
cp -r /usr/lib64/python2.7/site-packages/selinux $VIRTUAL_ENV/lib64/python2.7/site-packages
cp /usr/lib64/python2.7/site-packages/_selinux.so $VIRTUAL_ENV/lib64/python2.7/site-packages
cd demo
pip install -r requirements.txt
ansible-playbook --inventory ../../my_ansible/inventories/azure/hosts.yml \
--vault-password-file ~/.my_vault login.yml

Create one Azure SQL server and two databases

workon ansiblecopenhagenmeetup02
cd demo
ansible-playbook --inventory ../../my_ansible/inventories/azure/hosts.yml \
--vault-password-file ~/.my_vault \
--extra-vars "ansible_python_interpreter=${VIRTUAL_ENV}/bin/python" sql.yml

While it is provisioning, explain the role tasks and default variables.

Provision one Azure Cosmos DB using inline parameters

workon ansiblecopenhagenmeetup02
cd demo
ansible-playbook --inventory ../../my_ansible/inventories/azure/hosts.yml \
--vault-password-file ~/.my_vault \
--extra-vars "ansible_python_interpreter=${VIRTUAL_ENV}/bin/python" cosmosdb.yml

Provision two Azure Cosmos DBs using parameters from a list variable

workon ansiblecopenhagenmeetup02
cd demo
ansible-playbook --inventory ../../my_ansible/inventories/azure/hosts.yml \
--vault-password-file ~/.my_vault \
--extra-vars "ansible_python_interpreter=${VIRTUAL_ENV}/bin/python" \
--extra-vars '{"az_number_of":2}' cosmosdb.yml

While it is provisioning, explain the role tasks and default variables.

Provision three Azure Cosmos DBs using list variables and Jinja2

workon ansiblecopenhagenmeetup02
cd demo
ansible-playbook --inventory ../../my_ansible/inventories/azure/hosts.yml \
--vault-password-file ~/.my_vault \
--extra-vars "ansible_python_interpreter=${VIRTUAL_ENV}/bin/python" \
--extra-vars '{"az_number_of":3}' cosmosdb.yml

While it is provisioning, explain the role tasks and default variables.

Enable IP restrictions with the Azure REST API

workon ansiblecopenhagenmeetup02
cd demo
ansible-playbook --inventory ../../my_ansible/inventories/azure/hosts.yml \
--vault-password-file ~/.my_vault ip.yml

Enable IP restrictions with the Azure REST API - add many IPs

workon ansiblecopenhagenmeetup02
cd demo
ansible-playbook --inventory ../../my_ansible/inventories/azure/hosts.yml \
--vault-password-file ~/.my_vault many-ip.yml

Explain properties and loops.

Back