6 - name: create the nvme image systemd unit
10 Description=NVMe loop device
16 ExecStart=/bin/bash /opt/ceph-nvme.sh
17 StandardOutput=journal
21 WantedBy=multi-user.target
22 dest: "/etc/systemd/system/ceph-nvme.service"
24 - name: create the ceph-nvme startup script
33 losetup -v /dev/loop0 /opt/loop0_nvme0
35 nvmetcli restore /opt/loop.json
36 nvme connect -t loop -n testnqn -q hostnqn
38 dest: "/opt/ceph-nvme.sh"
40 - name: ensure ceph-nvme is enabled
46 - name: install nvme dependencies
54 - name: enable NVME kernel modules
63 - name: check if the nvme file is attached to loop0
64 command: losetup -l /dev/loop0
65 register: losetup_list
67 - name: detach current nvme0 file
68 command: losetup -d /dev/loop0
69 when: '"loop0_nvme0" in losetup_list.stdout'
71 - name: remove previous nvme0 file
73 path: /opt/loop0_nvme0
76 - name: create a 15GB sparse file for NVMe
77 command: fallocate -l 15G /opt/loop0_nvme0
79 - name: setup loop device with sparse file
80 command: losetup /dev/loop0 /opt/loop0_nvme0
82 - '"loop0_nvme0" not in losetup_list.stdout'
84 - name: create the loop.json file for nvmetcli
98 "treq": "not specified",
115 "allow_any_host": "0"
120 "nguid": "ef90689c-6c46-d44c-89c1-4067801309a8",
131 dest: "/opt/loop.json"
133 - name: setup the /dev/loop0 target with nvmetcli
134 command: nvmetcli restore /opt/loop.json
136 - name: connect the new target as an nvme device
137 command: nvme connect -t loop -n testnqn -q hostnqn
139 - name: debug output for nvme list