Seems like the module command: parameter isn’t working. Anyone have the same 
error?

playbook:
---
- hosts: linux
  gather_facts: yes
  become: yes
 
  vars:
    file: "CarbonBlackLinuxInstaller-v6.3.4.10012-Default-Group-210309.tar.gz"
    installdir: "/tmp/CarbonBlack-install"
    script: "CarbonBlackClientSetup-linux-v6.3.4.10012.sh"
    description: "install and start the Carbon Black Reponse agent"
 
  tasks:
    - set_fact:
        file="CarbonBlackLinuxDevelopment-210721.tar.gz"
        script="b9daemon.sh"
      when: (ansible_host is match("hqd-") or ansible_host is 
match("unix-dev-") or ansible_host is match(".dev") or 
ansible_all_ipv4_addresses[0] is match ("192.168.60.")) == true
 
    - name: "create {{installdir}}"
      file:
        path="{{installdir}}"
        mode="0755"
        state="directory"
 
    - name: "copy {{file}} to the {{ansible_host}}"
      copy:
        src="../templates/{{file}}"
        dest="{{installdir}}"
        owner="root"
        group="root"
        mode="0644"
        backup="yes"
 
    - name: "extract {{file}}"
      command:
        cmd="tar -xzvf {{file}}"
        chdir="{{installdir}}"
      register: x
 
    - debug:
        msg="installdir='{{installdir}}' file='{{file}}' shell='{{x}}"
 
    - fail: msg="doing fail for testing"
 
    - name: "run {{script}}"
      command:
        cmd="sh {{script}}"
        chdir="{{installdir}}"
 
    - name: "delete {{installdir}}"
      file:
        path: "{{installdir}}"
        state: absent

output:
ansible-playbook --limit hqd-dbora-n2 carbonblackresponse.yml
 
PLAY [linux] 
******************************************************************************************************************************************
 
TASK [Gathering Facts] 
********************************************************************************************************************************
ok: [hqd-dbora-n2]
 
TASK [set_fact] 
***************************************************************************************************************************************
ok: [hqd-dbora-n2]
 
TASK [create /tmp/CarbonBlack-install] 
****************************************************************************************************************
ok: [hqd-dbora-n2]
 
TASK [copy {{file}} to the {{ansible_host}}] 
**********************************************************************************************************
ok: [hqd-dbora-n2]
 
TASK [extract CarbonBlackLinuxDevelopment-210721.tar.gz] 
**********************************************************************************************
fatal: [hqd-dbora-n2]: FAILED! => {"changed": false, "cmd": "'cmd=tar -xzvf 
CarbonBlackLinuxDevelopment-210721.tar.gz'", "msg": "[Errno 2] No such file or 
directory", "rc": 2}
 
PLAY RECAP 
********************************************************************************************************************************************
hqd-dbora-n2               : ok=4    changed=0    unreachable=0    failed=1    
skipped=0    rescued=0    ignored=0

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/C76641E9-694B-4C64-BDB1-39A1BA803BBE%40gmail.com.

Reply via email to