Hey;

I'm trying to execute pvcreate on a disk but would like to ensure I don't 
run it on a disk that's already defined.  I have a short playbook that 
gathers facts, displays ansible_lvm.pvs.keys()
and then:

  - name: run pvcreate
    command: pvcreate /dev/{{item.key}}
    when: item.key is not in ansible_lvm.pvs.keys()
    with_dict: "{{disks}}"

That particular one resulted in:

The error was: template error while templating string: expected token 'end 
of statement block', got '.'.

Even if it didn't error out, I suspect it wouldn't work because the keys 
are:

    "msg": "dict_keys(['/dev/sdd', '/dev/sdb1', '/dev/sdc', '/dev/sda2'])"

I've also tried "when: /dev/item.key is not in..." and 'when: 
"/dev/item.key" is not in..." Those two result in:

The error was: template error while templating string: unexpected '/'.

Any hints on how to verify "/dev/{{item.key}" is not in the pvs dictionary?

Thanks

Doug O'Leary

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/71ead50e-54ce-43d0-ac07-3640e68eeaedo%40googlegroups.com.

Reply via email to