winapp.example.comHello, I have an inventory file that holds both windows application servers, web servers and only respective services which need to stopped or restarted. Requirement is only specific services should be stopped for group of hosts. For e.g. appservers hosts should use services under appservers:vars
Appreciate your help !!!
Inventory\hosts.ini file contains
[appservers]
winapp1.example.com
winapp2.example.com
[appservers:vars]
services:
- WorkflowService
- ConfigurationService
- SyncService
- ParentConfigurationService
[slaveappservers]
winslvapp1.example.com
winslvapp2.example.com
[slaveappservers:vars]
services:
- SyncService
- ParentConfigurationService
[webservers]
webser1.ent.wfb.bank.corp
[webservers:vars]
services:
- WorkflowService
- SyncService
- ParentConfigurationService
[allservers:children]
appservers
slaveappservers
webservers
service_stop.yml
---
- name: SHRP service stop Demo
hosts: all
gather_facts: false
tasks:
- name: Pause a service
win_service:
name: "{{ item }}"
state: stopped
loop:
- "{{ services }}"