Below the error message I showed where the file does exist on the remote host.
> On Jul 23, 2021, at 10:01, Stefan Hornburg (Racke) <[email protected]> wrote: > > On 23/07/2021 16:53, Mike Eggleston wrote: >> I looked for a “tar” module; I had forgotten about “unarchive”. I have >> changed my playbook and the relevant changed sections are below. I still get >> an error: > > "msg": "Could not find or access > '/tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz' on the > Ansible Controller.\nIf you are using a module and expect the file to exist > on the remote, see the remote_src option" > > What part of this error message is unclear? > > Regards > Racke > >> The changed sections of the playbook: >> - name: "copy {{file}} to the {{ansible_host}}" >> copy: >> src="../templates/{{file}}" >> dest="{{installdir}}/{{file}}" >> owner="root" >> group="root" >> mode="0644" >> backup="yes" >> - name: "extract {{file}}" >> unarchive: >> src="{{installdir}}/{{file}}" >> dest="{{installdir}}" >> register: x >> - debug: >> msg="installdir='{{installdir}}' file='{{file}}' command='{{y}}' >> unarchive='{{x}}" >> - fail: msg="doing fail for testing" >> Output from: ansible-playbook —limit had-dbora-s1 -vvv >> carbonblackresponse.yml >> 2021-07-23 10:38:59,326 p=3699 u=meggleston n=ansible | TASK [extract >> CarbonBlackLinuxDevelopment-210721.tar.gz] >> ********************************************************************************************** >> 2021-07-23 10:38:59,346 p=3751 u=meggleston n=ansible | <hqd-dbora-n2> >> ESTABLISH SSH CONNECTION FOR USER: None >> 2021-07-23 10:38:59,347 p=3751 u=meggleston n=ansible | <hqd-dbora-n2> SSH: >> EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o >> KbdInteractiveAuthentication=no -o >> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o >> PasswordAuthentication=no -o ConnectTimeout=10 -o >> ControlPath=/home/meggleston/.ansible/cp/7058214ea1 hqd-dbora-n2 '/bin/sh -c >> '"'"'( umask 77 && mkdir -p "` echo /tmp `"&& mkdir "` echo >> /tmp/ansible-tmp-1627051139.35-3751-266795384375758 `" && echo >> ansible-tmp-1627051139.35-3751-266795384375758="` echo >> /tmp/ansible-tmp-1627051139.35-3751-266795384375758 `" ) && sleep 0'"'"'' >> 2021-07-23 10:38:59,399 p=3751 u=meggleston n=ansible | <hqd-dbora-n2> (0, >> 'ansible-tmp-1627051139.35-3751-266795384375758=/tmp/ansible-tmp-1627051139.35-3751-266795384375758\n', >> '') >> 2021-07-23 10:38:59,400 p=3751 u=meggleston n=ansible | <hqd-dbora-n2> >> ESTABLISH SSH CONNECTION FOR USER: None >> 2021-07-23 10:38:59,401 p=3751 u=meggleston n=ansible | <hqd-dbora-n2> SSH: >> EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o >> KbdInteractiveAuthentication=no -o >> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o >> PasswordAuthentication=no -o ConnectTimeout=10 -o >> ControlPath=/home/meggleston/.ansible/cp/7058214ea1 hqd-dbora-n2 '/bin/sh -c >> '"'"'rm -f -r /tmp/ansible-tmp-1627051139.35-3751-266795384375758/ > >> /dev/null 2>&1 && sleep 0'"'"'' >> 2021-07-23 10:38:59,444 p=3751 u=meggleston n=ansible | <hqd-dbora-n2> (0, >> '', '') >> 2021-07-23 10:38:59,449 p=3699 u=meggleston n=ansible | fatal: >> [hqd-dbora-n2]: FAILED! => { >> "changed": false, >> "msg": "Could not find or access >> '/tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz' on the >> Ansible Controller.\nIf you are using a module and expect the file to exist >> on the remote, see the remote_src option" >> } >> 2021-07-23 10:38:59,450 p=3699 u=meggleston n=ansible | PLAY RECAP >> ******************************************************************************************************************************************** >> 2021-07-23 10:38:59,451 p=3699 u=meggleston n=ansible | hqd-dbora-n2 >> : ok=4 changed=0 unreachable=0 failed=1 skipped=0 >> rescued=0 ignored=0 >> Output of the directory showing the file is there: >> [meggleston@hq-mgtlinux-s1 ~]$ ssh hqd-dbora-n2 ls -l /tmp >> /tmp/CarbonBlack-install >> /tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz ; date >> -rw-r--r--. 1 root root 52643490 Jul 23 09:50 >> /tmp/CarbonBlack-install/CarbonBlackLinuxDevelopment-210721.tar.gz >> /tmp: >> total 0 >> drwxr-xr-x. 2 root root 55 Jul 23 09:50 CarbonBlack-install >> /tmp/CarbonBlack-install: >> total 51412 >> -rw-r--r--. 1 root root 52643490 Jul 23 09:50 >> CarbonBlackLinuxDevelopment-210721.tar.gz >> Fri Jul 23 10:42:39 EDT 2021 >>> On Jul 23, 2021, at 09:23, Stefan Hornburg (Racke) <[email protected] >>> <mailto:[email protected]>> wrote: >>> >>> On 23/07/2021 16:07, Mike Eggleston wrote: >>>> Seems like the module command: parameter isn’t working. Anyone have the >>>> same error? >>> >>> Hello Mike, >>> >>> the tar binary is probably missing in the $PATH Ansible is using. The $PATH >>> is most likely different compared to $PATH >>> the interactive shell is using on the host. >>> >>> Also consider to use the unarchive module instead. >>> >>> Regards >>> Racke >>> >>>> 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 >>> >>> >>> -- >>> Ecommerce and Linux consulting + Perl and web application programming. >>> Debian and Sympa administration. >>> >>> -- >>> 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] >>> <mailto:[email protected]>. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/7f45b64d-0184-2c37-bf7f-1b6170f73b2b%40linuxia.de >>> >>> <https://groups.google.com/d/msgid/ansible-project/7f45b64d-0184-2c37-bf7f-1b6170f73b2b%40linuxia.de>. >> -- >> 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] >> <mailto:[email protected]>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/22697C31-36B9-456D-8CEF-1356D3EE384A%40gmail.com >> >> <https://groups.google.com/d/msgid/ansible-project/22697C31-36B9-456D-8CEF-1356D3EE384A%40gmail.com?utm_medium=email&utm_source=footer>. > > > -- > Ecommerce and Linux consulting + Perl and web application programming. > Debian and Sympa administration. > > -- > 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/0955e528-8dda-b440-4bfb-5b7e8f39af38%40linuxia.de. -- 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/B70EEA2E-69F5-479B-B4E4-E1D96435CE04%40gmail.com.
