To use this example repo, clone it and build the devcontainer defined in the repository
Once the devcontainer build completes, create an ansible vault (EDITOR=nano ansible-vault create vars.yml
) with the following variables defined:
win_admin_password
azure_resource_group_name
With the vault created, you can use the examples commands below to play with Ansible in Azure!
az login
ansible-playbook create_azure_winvm.yml -e @vars.yml --ask-vault-pass
ansible-playbook -i inventory_azure_rm.yml test_azure_winvm.yml -e @vars.yml --ask-vault-pass
ansible-playbook -i inventory_azure_rm.yml windows_fs_config.yml -e @vars.yml --ask-vault-pass
ansible-playbook create_azure_ubuntuvm.yml -e @vars.yml --ask-vault-pass
ansible-playbook -i inventory_azure_rm.yml test_azure_ubuntuvm.yml -e @vars.yml --ask-vault-pass
ssh azureadmin@<publicipaddress> -i /tmp/id_ssh_rsa
ansible-playbook -i inventory_azure_rm.yml apt_package_install.yml -e @vars.yml --ask-vault-pass
ansible-inventory -i inventory_azure_rm.yml -e @vars.yml --ask-vault-pass --list
ansible-cmdb -f out/ > cmdb.html
ansible-cmdb -t markdown -f out/ > cmdb.md
ansible-cmdb -t sql -f out/ > cmdb.sql
rm cmdb.*
ansible-playbook cleanup_resources.yml -e @vars.yml --ask-vault-pass
- Curated list of community resources to learn more about Ansible
- Ansible 101 video series by Jeff Geerling
- Azure Ansible Collection Documentation
- Ansible-CMDB Documentation