Ansible WinRM manage vm (and RabbitMQ)

Repo

azure-ansible/1-4-az-existing-windows-vm/readme.md at main · spawnmarvel/azure-ansible · GitHub

We are simulating an existing vm not created by ansble, and managing it after created by someone.

We set up from above repos

  • Winrm
  • Ports
  • Cert
  • User

We configured an inventory and ansible.cfg and pong’d it.

All code is stored in the repos.

Lets make a yml and create a folder on the windows server.

We we use that folder to create a file, for logging all we do.

Now create a file

Take a backup of the file using copy module

Now update the file with ansible

Ansible run remote script (install iis), check if it is installed and output to log

log

visit ip

stop iis service and log it, start it and log it

Day 2

Install Rabbimq manual, enable management.

Use Ansible stop service, backup file then push a new rabbitmq.conf file and start.

Here we are using jinja Ansible vars in ps1 script to log to output.

Now there is an auto backup using Ansible copy module, every time the is a difference from src to dest.

Scroll to Top