# Templates and SELinux contect types

**URL:** <https://forum.ansible.com/t/templates-and-selinux-contect-types/12913>\
**Category:** Ansible Project\
**Created:** [June 6, 2013, 9:08am UTC](https://forum.ansible.com/t/templates-and-selinux-contect-types/12913 "2013-06-06T09:08:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vincent\_Van\_der\_Kuss](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@Vincent\_Van\_der\_Kuss](https://forum.ansible.com/u/Vincent_Van_der_Kuss)\
**Post date:** [June 6, 2013, 9:08am UTC](https://forum.ansible.com/t/templates-and-selinux-contect-types/12913/1 "2013-06-06T09:08:27Z")

</div>

Hi,

I've got a bit of a problem using SELInux context types with Ansible.

When I use a template, the SELinux context type is not correctly  
applied and i want to restore it to the context in the policy.  
If I look at the documentation of the file module I see that you can  
use "context" for this. I tried this with using both file and template  
( i believe template can use the file module's options?)

But I get this error

"msg: unsupported parameter for module: context"

This is the part from the tasks yaml in the role

file: path="/etc/openldap/slapd.d/cn=config/olcDatabase={2}bdb.ldif"  
context=default

Regards,  
Vincent

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [June 6, 2013, 12:48pm UTC](https://forum.ansible.com/t/templates-and-selinux-contect-types/12913/2 "2013-06-06T12:48:46Z")

</div>

Thanks for the heads up, if this is on Ansible 1.2, please file a bug with steps to reproduce and I’ll take a look at reproducing this.

---

<div class="post-metadata">

**Author:** ![Vincent\_Van\_der\_Kuss](https://avatars.discourse-cdn.com/v4/letter/v/7c8e57/32.png) [@Vincent\_Van\_der\_Kuss](https://forum.ansible.com/u/Vincent_Van_der_Kuss)\
**Post date:** [June 6, 2013, 3:09pm UTC](https://forum.ansible.com/t/templates-and-selinux-contect-types/12913/3 "2013-06-06T15:09:34Z")

</div>

Hi

I'm going to check again later on because I forgot to install  
policycoreutils on the host so all SELinux related actions had no  
result.  
But I'm not sure this error is related.

Vincent

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [June 6, 2013, 6:12pm UTC](https://forum.ansible.com/t/templates-and-selinux-contect-types/12913/4 "2013-06-06T18:12:15Z")

</div>

Yeah, it shouldn’t be that they had no result in that case, but rather that you should get an error when you try to use those options.

(Please file a ticket on that…)
