The issue is that with_ loops puts results in a list, under 'results' key,
so `UUID.item` won't work, you need an index that matches, this might help.

http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-a-list-with-an-index

On Mon, Mar 21, 2016 at 8:18 AM, Dayton Jones <[email protected]>
wrote:

> I'm trying to read fstab and update any entry that uses "LABEL=" to use
> the UUID instead..
>
> I can get the proper UUID mappings, but I can't seem to wrap my head
> around the actual replacement...
>
> playbook:
>
>   - name: Gather UUID mappings
>     shell: "blkid -s UUID -o value -t LABEL={{item}}"
>     with_items:
>       - "/home"
>       - "/var"
>       - "/"
>     ignore_errors: true
>     register: "UUID"
>
>   - name: Convert fstab LABEL entries to UUID format
>     replace:
>         dest=/etc/fstab
>         regexp='LABEL={{ item }}'
>         replace='UUID={{UUID.item}}'
>         backup=yes
>     with_items:
>        - "/"
>         - "/home"
>         - "/var"
>
> For the highlighted lines, what should I be using - or is there a better
> way (I've looked at the mount module, but didn't see a way to do this)
>
> --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/e30757f2-9437-4659-b2d5-d385db1a7910%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/e30757f2-9437-4659-b2d5-d385db1a7910%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
----------
Brian Coca

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7dLGR8BT%2B2C2xo5uoZSP1B_FwgLM_OofHptidbuLZ1rAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to