---
- name: Ensure Kolla host services are configured
  hosts: controllers
  tags:
    - kolla-ansible
    - kolla-host
  tasks:
    - name: Ensure host iSCSI services are stopped and disabled
      service:
        name: "{{ item }}"
        state: stopped
        enabled: no
      become: True
      with_items:
        - iscsid.socket
        - iscsiuio.socket
        - iscsid.service
      register: result
      failed_when:
        - result is failed
        # If a service is not installed, the ansible service module will fail
        # with this error message.
        - '"Could not find the requested service" not in result.msg'
      when: kolla_enable_ironic | bool
