Ansible command module giving errors in playbook

5 views
Skip to first unread message

visar

unread,
Nov 12, 2018, 10:05:28 AM11/12/18
to Ansible Project

I am creating a playbook to silently execute a installation package using Command module. But here I am getting playbook execution error. Below is my playbook sample.

Here my aim is to execute the myibm silent package only if the specified path is not present "/opt/IBM/myibm". But here i am not able to run this play successfully, but the local manual command execution is success. so the issue with my playbook.


  - name: Silent installation
    hosts: myserver
    tasks:
     - name: execute the WEB installation package 
       command: installc -installationDirectory /opt/IBM/packagefile
       args:
        chdir: /opt/im/linux.gtk.x86_64/
        creates: /opt/IBM/myibm

Brian Coca

unread,
Nov 12, 2018, 10:26:34 AM11/12/18
to ansible...@googlegroups.com
Ansible uses a 'batch login' by default, which might not source the
same files as an interactive one and not have the same PATH set, so
either use full path for installc or use the `environement:` keyword
to ensure the correct PATH is set.

--
----------
Brian Coca

visar

unread,
Nov 12, 2018, 10:56:06 AM11/12/18
to Ansible Project
Hello Brian,

Thanks for your valuable advise, i modifed my playbook with vars as the path of the installer  as below and still have the error.

---

 - name: Silent installation of "IBM Installation Manager"
   hosts: IHS
   vars:
     Pack_dir: /opt/CLM-Web-Installer-Linux-6.0.5/im/linux.gtk.x86_64
   tasks:
     - name: check for package
       stat:
         path: '{{ Pack_dir }}/installc'
     - name: execute the WEB installation package of Installation manger silently
       command: installc -installationDirectory /opt/IBM/InstallationManager -svP -acceptLicense
        creates: /opt/IBM/InstallationManager

Brian Coca

unread,
Nov 12, 2018, 11:02:00 AM11/12/18
to ansible...@googlegroups.com
That does not modify the command task, so i expect it to keep giving
the same error.


--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages