# pickup hostname and create self signed certificate

**URL:** <https://forum.ansible.com/t/pickup-hostname-and-create-self-signed-certificate/29125>\
**Category:** Ansible Project\
**Created:** [November 27, 2018, 1:18pm UTC](https://forum.ansible.com/t/pickup-hostname-and-create-self-signed-certificate/29125 "2018-11-27T13:18:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivek1](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@Vivek1](https://forum.ansible.com/u/Vivek1)\
**Post date:** [November 27, 2018, 1:18pm UTC](https://forum.ansible.com/t/pickup-hostname-and-create-self-signed-certificate/29125/1 "2018-11-27T13:18:23Z")

</div>

Hello Experts,

i have working command for creating self signed certificate for IHS server’s .kdb file and i was trying to use the same command through ansible. Here my aim is that ansible should detect the hostname of application servers and should use that name for the “-dn” of the command.

Below is the working command

[root@myhost bin]# ./gskcmd -cert -create -db /opt/myapp/key.kdb -label IHS -expire 3650 -size 2048 -dn “CN=myserverFQDN” -default\_cert yes -pw password

but below is my play and its giving syntax error

---

<div class="post-metadata">

**Author:** ![Bharath\_Kumar2](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@Bharath\_Kumar2](https://forum.ansible.com/u/Bharath_Kumar2)\
**Post date:** [November 28, 2018, 3:08am UTC](https://forum.ansible.com/t/pickup-hostname-and-create-self-signed-certificate/29125/2 "2018-11-28T03:08:38Z")

</div>

Please try the below.

`

---

<div class="post-metadata">

**Author:** ![Vivek1](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@Vivek1](https://forum.ansible.com/u/Vivek1)\
**Post date:** [November 28, 2018, 8:18am UTC](https://forum.ansible.com/t/pickup-hostname-and-create-self-signed-certificate/29125/3 "2018-11-28T08:18:52Z")

</div>

Hello Bharath,

Thanks a lot… it worked… appreciate your help here…
