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:
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: