# luks\_device module questions

**URL:** <https://forum.ansible.com/t/luks-device-module-questions/31536>\
**Category:** Ansible Project\
**Created:** [October 24, 2019, 9:23am UTC](https://forum.ansible.com/t/luks-device-module-questions/31536 "2019-10-24T09:23:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Test\_Acct](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@Test\_Acct](https://forum.ansible.com/u/Test_Acct)\
**Post date:** [October 24, 2019, 9:23am UTC](https://forum.ansible.com/t/luks-device-module-questions/31536/1 "2019-10-24T09:23:51Z")

</div>

Hello.  
I am trying to create encrypted logical volumes within my playbook. I have the process written out, via commands (as if i were doing each one individually).  
I have gotten the LVM portion in the playbook working. I had found the luks\_device and crypttab modules to try to use. I have not been able to get them to work, using the documentation examples. Is there someone who can assist or tutor these modules and help me break down my commands into the playbook via these modules? Currently, I keep getting syntax errors when doing

- name: create luks device named Vol0  
luks\_device:  
device: “/dev/VolGroup0”  
state: “present”  
name: “Vol0”  
keyfile: “/root/luks.key”

It’s stating the error is at the -name portion… I have checked for tab spaces, etc. I have also tried without the quotation marks. Any assistance would be wonderful.

Thanks

J

---

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [October 24, 2019, 9:38am UTC](https://forum.ansible.com/t/luks-device-module-questions/31536/2 "2019-10-24T09:38:13Z")

</div>

If it’s a syntax error, then it has nothing to do with the specific modules you are using or their parameters; it has to do with the text of the playbook only. You can use the -C option to ansible-playbooks to ensure that the playbook doesn’t actually DO anything. If it ever gets to the point of trying, you know your syntax is good 🙂

Syntax errors are often not where Ansible says they are; Ansible can only tell you where it was up to when it noticed the error. So please provide the entire playbook, or at least the plays above and below the one where you think the syntax error is.

Also, paste your sample code using a monospace typeface to preserve its indentation. Zillions of syntax errors in Ansible are caused by bad indenting. Here is your snippet, properly formatted for this mailing list:

- name: create luks device named Vol0  
luks\_device:  
device: “/dev/VolGroup0”  
state: “present”  
name: “Vol0”  
keyfile: “/root/luks.key”

If you are using a text-only mailer, consider using an HTML-capable mailer at least for posting code.

You will save yourself grief if you always quote strings, even when it is not strictly necessary.

Regards, K.

---

<div class="post-metadata">

**Author:** ![Test\_Acct](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@Test\_Acct](https://forum.ansible.com/u/Test_Acct)\
**Post date:** [October 24, 2019, 2:51pm UTC](https://forum.ansible.com/t/luks-device-module-questions/31536/3 "2019-10-24T14:51:46Z")

</div>

I was using the group page. I typed it out within my vi editor on my server. I have checked for tabs or weird spacing, all around that module and the ones before it. I did that first, since I had issues when i first pasted my play. I have been running the check version of the playbook. I got the same issue on both types of run.

Is there better guidance or tutorial on the luks\_device module? For now I have just done raw: command instead. but I had hoped to use the luks module to improve upon and actually use my playbook effectively. I’d even like to use the crypttab module as well for this section.

- J

---

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [October 24, 2019, 3:07pm UTC](https://forum.ansible.com/t/luks-device-module-questions/31536/4 "2019-10-24T15:07:29Z")

</div>

**Please provide the entire playbook, or at least the plays above and below the one where you think the syntax error is. And provide it in a monospace typeface.**

We can probably help with a syntax problem. But not if we can’t see your playbook.

Regards, K.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [October 24, 2019, 5:19pm UTC](https://forum.ansible.com/t/luks-device-module-questions/31536/5 "2019-10-24T17:19:46Z")

</div>

Hi,

> It's stating the error is at the -name portion... I have checked for  
> tab spaces, etc. I have also tried without the quotation marks. Any  
> assistance would be wonderful.

could you please paste the exact error message? If it is a module  
failure (and not a syntax error), try to run the playbook with -vvv and  
paste the output for this task. (As cleanly as that's possible 😉 )

Cheers,  
Felix
