Reputation: 12200
I'm attempting to write a playbook to format a certain volume, but I can't get my head around choosing the correct drive
here is what I'm working on
---
- hosts: all
gather_facts: no
remote_user: root
tasks:
- name: create file system on storage lun
filesystem: fstype=xfs dev=/dev/mapper/mpath*
I'm trying to match any single character after mpath, but * doesn't seem to work.
Upvotes: 1
Views: 1094
Reputation: 19912
Wildcards wouldn't work in there. You need to get this information in an additional task or alternatively from the setup module.
Example:
- command: ls /dev/mapper/mpath*
register: mapper
- filesystem: fstype=xfs dev="{{ mapper.stdout_lines[0] }}"
Haven't tested the above but that is the general idea.
Upvotes: 3