---
- hosts: all
  pre_tasks:
    - name: Include user-override vars
      include_vars: "{{ rock_config }}"
  tasks:
    - name: Populate service facts
      service_facts:

    - name: Flatten ROCK services
      set_fact:
        flat_services: "{{ ansible_facts.services | flatten(levels=1) | replace('.service', '')  }}"

    - name: collect enabled services
      set_fact:
        enabled_services: {{ rock_services | selectattr("enabled", "equalto", True) | map(attribute="name") | list }}

    - name: Collect ROCK services from facts
      set_fact:
        host_services: "{{ flat_services | intersect(enabled_services) }}"

    - name: Perform requested service action
      service:
        name: "{{ item }}"
        state: "{{ service_state }}"
      loop: "{{ host_services }}"
      tags:
        - service_mgmt

    - name: Register service status
      shell: systemctl status -n 3 {{ item }}*
      loop: "{{ host_services }}"
      register: services
      changed_when: false
      tags:
        - service_status

    - name: Output service status
      debug:
        msg: "{{ item.stdout }}"
      loop: "{{ services.results }}"
      loop_control:
        label: "{{ item._ansible_item_label }}"
      tags:
        - service_status

---
- hosts: all
  pre_tasks:
    - name: Include user-override vars
      include_vars: "{{ rock_config }}"
  tasks:
    - name: Populate service facts
      service_facts:

    - name: Flatten ROCK services
      set_fact:
        flat_services: "{{ ansible_facts.services | flatten(levels=1) | replace('.service', '')  }}"

    - name: collect enabled services
      set_fact:
        enabled_services: "{{ rock_services | selectattr('enabled', 'equalto', True) | map(attribute='name') | list }}"

    - name: Collect ROCK services from facts
      set_fact:
        host_services: "{{ flat_services | intersect(enabled_services) }}"

    - name: Perform requested service action
      service:
        name: "{{ item }}"
        state: "{{ service_state }}"
      loop: "{{ host_services }}"
      tags:
        - service_mgmt

    - name: Register service status
      shell: systemctl status -n 3 {{ item }}*
      loop: "{{ host_services }}"
      register: services
      changed_when: false
      tags:
        - service_status

    - name: Output service status
      debug:
        msg: "{{ item.stdout }}"
      loop: "{{ services.results }}"
      loop_control:
        label: "{{ item._ansible_item_label }}"
      tags:
        - service_status

Fix quoting of manage services playbook
Fix quoting of manage services playbook

Fixes #487