---
- name: Starting iscsid container
  become: true
  kolla_docker:
    action: "start_container"
    common_options: "{{ docker_common_options }}"
    image: "{{ iscsid_image_full }}"
    name: "iscsid"
    ipc_mode: "host"
    privileged: True
    volumes:
      - "{{ node_config_directory }}/iscsid/:{{ container_config_directory }}/:ro"
      - "kolla_logs:/var/log/kolla/"
      - "/etc/localtime:/etc/localtime:ro"
      - "/dev/:/dev/"
      - "/run/:/run/:shared"
      - "/sys/fs/cgroup:/sys/fs/cgroup:ro"
      - "/lib/modules:/lib/modules:ro"
      - "/sys/kernel/config:/configfs"
      - "cinder:/var/lib/cinder"
      - "iscsi_info:/etc/iscsi"
  when: ( ( inventory_hostname in groups['compute'] or inventory_hostname in groups['cinder-volume'] ) and enable_cinder | bool and enable_cinder_backend_iscsi | bool  )
         or ( inventory_hostname in groups['ironic-conductor'] and enable_ironic | bool )

- name: Starting tgtd container
  become: true
  kolla_docker:
    action: "start_container"
    common_options: "{{ docker_common_options }}"
    image: "{{ tgtd_image_full }}"
    name: "tgtd"
    ipc_mode: "host"
    privileged: True
    volumes:
      - "{{ node_config_directory }}/tgtd/:{{ container_config_directory }}/:ro"
      - "kolla_logs:/var/log/kolla/"
      - "/etc/localtime:/etc/localtime:ro"
      - "/dev/:/dev/"
      - "/run/:/run/:shared"
      - "/sys/fs/cgroup:/sys/fs/cgroup:ro"
      - "/lib/modules:/lib/modules:ro"
      - "/sys/kernel/config:/configfs"
      - "cinder:/var/lib/cinder"
      - "iscsi_info:/etc/iscsi"
  when:
    - inventory_hostname in groups['tgtd']
    - enable_cinder | bool
    - enable_cinder_backend_lvm | bool
    - cinder_iscsi_helper == "tgtadm"
