Make Ansible-managed console app highly available

Hi Guys,

We have an automated process that’s run within a console application. Ansible is used to manage the run-schedule. Each time the console app needs to be run, Ansible connect to the Win server and runs the task.

Right now this process is hosted on a single Windows server. I would like to have it on two servers and configure Ansible to either (a) load balance running the console between the two servers. Meaning, each time it’s scheduled to run, alternate between servers. Or, (b) always run on Server01, but if that’s down, run on Server 02.

Are there any built-in features within Ansible that we can utilise to make this easy? If not, how do you recommend we approach this?

Option B is the easiest. You could create two tasks in a playbook. Task 1 targets first window server 1 and run your console app; Capture the return code from this task. Repeat the same task for window server 2, but set a condition that it runs only if the first failed.
You will need to use the delegate_to for each task.

What about the ansible task option of run_once. Probably the simplest method.

Mike

Will you have to worry about shared data? If so, then you’ll need a shared storage solution, and should really think about quorom and monitoring then as well. Seems overkill.
You could just use DNS round-robin with 2 IPs to load share.