Please try the below.

---
hosts: IHS
gather_facts: yes

  tasks:
  
    - name: Create Self Signed Certificate for IHS

      command: /opt/myapp/bin/gskcmd -cert -create -db /opt/myapp/key.kdb 
-label 
IHS -expire 3650 -size 2048 -dn "CN={{ ansible_fqdn }}" -default_cert yes -pw 
password





On Tuesday, November 27, 2018 at 8:18:23 AM UTC-5, visar wrote:
>
> 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
>
> ---
>
> - name: installation
>   hosts: IHS
>   tasks:
>     - name: get hostname
>       shell: echo $HOSTNAME
>       register: hostname
>
>     - name: create self signed certificate for IHS
>       command: /opt/myapp/bin/gskcmd -cert -create -db /opt/myapp/key.kdb 
> -label IHS -expire 3650 -size 2048 -dn "CN={{ hostname}}" -default_cert yes 
> -pw password
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/11088c81-8d80-42ce-badc-cff92f51ff1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to