I work on role for administrate an elastic cluster.

When i execute this :

- name: Get Statistic of index
  uri:
    url: "{{ update_index }}"
    method: GET
    body: ""
    body_format: json
  register: result_stats
  when: index_ is defined and index

- debug:
    msg: "{{ index_ }}"

- debug:
    msg: "{{ result_stats.json }}"

I have this response :

TASK [elastic_search_create_index : Get Statistic of index]
*******************************************************************
ok: [vmelastic02.preprod]

TASK [elastic_search_create_index : debug]
************************************************************************************
ok: [vmelastic02.preprod] => {
    "msg": "webshop-de-preprod"
}

TASK [elastic_search_create_index : debug]
************************************************************************************
ok: [vmelastic02.preprod] => {
    "msg": {
        "webshop-de-preprod": {
            "settings": {
                "index": {
                    "creation_date": "1626441304247",
                    "number_of_replicas": "2",
                    "number_of_shards": "1",
                    "provided_name": "webshop-de-preprod",
                    "routing": {
                        "allocation": {
                            "include": {
                                "_tier_preference": "data_content"
                            }
                        }
                    },
                    "uuid": "hVD9st6VSyiFmTI6pMqjIQ",
                    "version": {
                        "created": "7130399"
                    }
                }
            }
        }
    }
}


I would like get the value of number_of_replicas

but when i test :
- debug:
    msg: "{{ result_stats.json.{{ index_ }} }}"

I have an error, how can I do that ?

thanks
--
Stéphane CREMEL

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAMF%2BGq1kp%2BiyH20a6d%2BwFXYrCfraG0ZeP_DUirxfnLz7Dn077A%40mail.gmail.com.

Reply via email to