Can Ansible watch for new target machines in Azure?

Viewed 89

I'm automating the deploying of Azure Resource Groups and Virtual Machines. I'd like to have a Ansible Controller recognize when new VMs are created so that it can run playbooks on them and configure them for me.

How do I get Ansible to recognize new VMs created in Azure

1 Answers

No, Ansible on its own can't do that.

Ansible is an agentless tool that do the job only when you (or some other external system) ask it to.

You have some options:

  • setup some monitoring system that will watch for new VMs and trigger Ansible playbook runs
  • setup some cloud events (not sure if there are any in Azure, like CloudWatch Events in AWS) that will trigger your Ansible jobs
  • setup dynamic inventory for your playbook (that will list all VMs provisioned and new) and run your playbooks with cron Job
  • setup ansible-pull inside your cloud VM images, so it pulls required playbooks at VM startup and provision machine automatically
Related