---
- include: disable_os_collect_config.yml
- hosts: undercloud
  name: Disable Undercloud
  tasks:
    - service: name={{ item }} enabled=no state=stopped
      with_items: undercloud_services
- hosts: nova-compute
  name: Disable Overcloud Compute
  tasks:
    - service: name={{ item }} enabled=no state=stopped
      with_items: overcloud_compute_services
- hosts: controller
  name: Disable Overcloud Controller
  tasks:
    - service: name={{ item }} enabled=no state=stopped
      with_items: overcloud_controller_services
- hosts: all
  name: Rebuild and Refresh
  tasks:
    - include: rebuild.yml
    - include: refresh_config.yml
- hosts: controller
  name: Enable Overcloud Controller
  tasks:
    - service: name={{ item }} enabled=yes state=started
      with_items: overcloud_controller_services
- hosts: nova-compute
  name: Enable Overcloud Compute
  tasks:
    - service: name={{ item }} enabled=yes state=started
      with_items: overcloud_compute_services
- hosts: undercloud
  name: Enable Undercloud
  tasks:
    - service: name={{ item }} enabled=yes state=started
      with_items: undercloud_services

---
- include: disable_os_collect_config.yml
- hosts: undercloud
  name: Disable Undercloud
  tasks:
    - service: name={{ item }} enabled=no state=stopped
      with_items: undercloud_services
- hosts: nova-compute
  name: Disable Overcloud Compute
  sudo: yes
  tasks:
    - service: name={{ item }} enabled=no state=stopped
      with_items: overcloud_compute_services
- hosts: controller
  name: Disable Overcloud Controller
  sudo: yes
  tasks:
    - service: name={{ item }} enabled=no state=stopped
      with_items: overcloud_controller_services
- hosts: all
  name: Rebuild and Refresh
  tasks:
    - include: rebuild.yml
    - include: refresh_config.yml
- hosts: controller
  name: Enable Overcloud Controller
  sudo: yes
  tasks:
    - service: name={{ item }} enabled=yes state=started
      with_items: overcloud_controller_services
- hosts: nova-compute
  name: Enable Overcloud Compute
  sudo: yes
  tasks:
    - service: name={{ item }} enabled=yes state=started
      with_items: overcloud_compute_services
- hosts: undercloud
  name: Enable Undercloud
  sudo: yes
  tasks:
    - service: name={{ item }} enabled=yes state=started
      with_items: undercloud_services

Use sudo when running service commands
Use sudo when running service commands

We need to enable/disable and start/stop services as root.
