You can have multiple plays inside one playbook.  This lets you target 
different groups of servers - something like this:

---
- hosts: webservers
  roles:
    - webservers_stop


- hosts: databases
  roles:
    - databases_stop


- hosts: webservers:databases
  roles:
  - common_services_stop
  
- hosts: localhost
  tasks:
    vmware_guest: 
      ... powerdown commands would go here


  
Hope this helps,

Jon

On Monday, March 13, 2017 at 1:38:34 PM UTC, Jonay Herrera y Steendam wrote:
>
> Hi,
>
> I am new with   ansible and  will  try  to  automate the  whole 
>  stop/start  procedure  of a platform  but I don't know how to start:
> this  is the  sequence:
>
>    1. stop all client applications  on  appserver1,appserver2, 
>    appserver3, appserver4
>    2. stop the  Linux  servers (poweroff) appserver1, appserver2, 
>    appserver3, appserver4 on  Vmware
>    3. stop  apps on the  master servers mainserver1, mainserver2
>    4. stop Linux ( poweroff)  of  the  masterservers on  Vmware
>
> and  when  the  same  to  start the  application platform, but I think 
> that  I need  two  playbooks  to  stop and  to start the  platform?
> my Idea was  something like this :
>
> playbook:
> - name: automatic STOP Application platform 
>   hosts: MDC
>   sudo: True
>   vars_files:
>     # User defined variables for infrastructure
>     - infra-vars.yml
>     # Infrastructure passwords
>     #- secrets.yml
>   roles:
>     - role: STOP_APPSSERVERS
>     - role: STOP_MAINSERVERS
>
> but can  I define  different  servers  for  the  different  roles on 
>  central inventory ?
>
> because  this  need   to  be usable  for  a development  environment, 
> preproduction environment and  production  environment. and  each 
>  environment has  his  own  servers ...
>
> thanks to   help  me,
>
> Jonay
>     
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/64d592ec-1536-49ee-b813-54cd8877f279%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to