---
- name: Get a list of existing cells
  vars:
    nova_conductor: "{{ nova_cell_services['nova-conductor'] }}"
  become: true
  kolla_container:
    action: "start_container"
    command: bash -c 'sudo -E kolla_set_configs && nova-manage cell_v2 list_cells --verbose'
    common_options: "{{ docker_common_options }}"
    detach: False
    image: "{{ nova_conductor.image }}"
    labels:
      BOOTSTRAP:
    name: "nova_list_cells"
    restart_policy: oneshot
    volumes: "{{ nova_cell_get_settings_volumes }}"
  register: existing_cells_list
  changed_when: false
  failed_when:
    - existing_cells_list.rc != 0
  check_mode: false

- name: Extract current cell settings from list
  vars:
    nova_conductor: "{{ nova_cell_services['nova-conductor'] }}"
  set_fact:
    nova_cell_settings: "{{ existing_cells_list | extract_cell(nova_cell_name) }}"
