Low Orbit Flux Logo 2 F

Ansible - Multiple Plays

Breaking a playbook into multiple plays allows you to specify differnt sets of hosts and a different remote_user for each play.



---
- hosts: webservers
  remote_user: root

  tasks:
  - name: ensure apache is at the latest version
    yum:
      name: httpd
      state: latest

- hosts: databases
  remote_user: admin

  tasks:
  - name: ensure postgresql is at the latest version
    yum:
      name: postgresql
      state: latest