Ansible - create LVM

Hello,
I’m pretty new in ansible, so excuse me for this (stupid?) question, but it bothers me.

I’m trying to set up LVM on the remote host with ansible.

Here is my role:

`

As the output of some shell-command is not per se delimited to one single value, registering it creates a list.

Thus, using “{{ some_list }}” get’s you square-brackets around the list of values - although in your case, it’s a list with just one single value.

Besides omitting the parameter, you could for instance join the list to a string: “{{ drive_for_lvm | join ‘’ }}”, see https://docs.ansible.com/ansible/playbooks_filters.html#id7
… or you could limit the list to its first element, either with “{{ drive_for_lvm[0] }}” or “{{ drive_for_lvm | first }}”, see again the filters or https://docs.ansible.com/ansible/playbooks_variables.html#accessing-complex-variable-data

Thank you so much for exhaustive explanation.

Best regards,
Michal