May I know what is " item.strip().split()[0] " mean in below code? I'm thining, first value in a space seperated line.
Ref: https://github.com/geerlingguy/ansible-role-nfs/blob/master/tasks/main.yml
- name: Ensure directories to export exist
| ||||||
---
- hosts: all
become: no
connection: local
vars:
nfs_exports: { "/home/public *(rw,sync,no_root_squash)" }
tasks:
- name: Ensure directories to export exist
debug:
msg: "{{ item.strip().split()[0] }}"
with_items: "{{ nfs_exports }}"
─➤ ansible-playbook -i localhost, -c local playbook.yml
PLAY [all] *******************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************
ok: [localhost]
TASK [Ensure directories to export exist] ************************************************************************************
ok: [localhost] => (item=/home/public *(rw,sync,no_root_squash)) => {
"item": "/home/public *(rw,sync,no_root_squash)",
"msg": "/home/public"
}
PLAY RECAP *******************************************************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0