ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14k stars 3.42k forks source link

Problem with using the Copy module #7493

Closed thisID closed 4 years ago

thisID commented 4 years ago
ISSUE TYPE
SUMMARY
ENVIRONMENT
STEPS TO REPRODUCE

My PlayBook script is on Github, My jdk file is on the local server

--- 

   - hosts: all
     gather_facts: yes
     remote_user: root 
     vars_files:
           - vars.yml

     tasks:
     - block:
          - name: check java-version
            shell: java -version
            register: checkjdk

       rescue:
          - name: judgesystem7
            copy: src=/opt/jdk/jdk-8u131-linux-x64-replace-jce.tar.gz  dest=/opt  mode=0644   remote_src=false
            when: ansible_distribution_major_version  == "7"  and checkjdk.rc != 0

          - name: judgesystem8
            copy: src=/opt/jdk/jdk-14.0.1_linux-x64_bin.tar.gz dest=/opt  mode=0644   remote_src=false
            when: ansible_distribution_major_version  == "8"  and checkjdk.rc != 0

But the execution failed

ansible-playbook 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/plugins/library']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
Using /etc/ansible/ansible.cfg as config file
SSH password: 
PLAYBOOK: installjdk5.yml ******************************************************
1 plays in test/installjdk/test5/installjdk5.yml
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
task path: /tmp/awx_849__evdvtj5/project/test/installjdk/test5/installjdk5.yml:3
ok: [192.168.73.151]
ok: [192.168.73.150]
META: ran handlers
TASK [check java-version] ******************************************************
task path: /tmp/awx_849__evdvtj5/project/test/installjdk/test5/installjdk5.yml:11
fatal: [192.168.73.150]: FAILED! => {"changed": true, "cmd": "java -version", "delta": "0:00:00.036384", "end": "2020-07-01 15:04:34.340782", "msg": "non-zero return code", "rc": 127, "start": "2020-07-01 15:04:34.304398", "stderr": "/bin/sh: java: command not found", "stderr_lines": ["/bin/sh: java: command not found"], "stdout": "", "stdout_lines": []}
fatal: [192.168.73.151]: FAILED! => {"changed": true, "cmd": "java -version", "delta": "0:00:00.003723", "end": "2020-07-01 15:04:34.258213", "msg": "non-zero return code", "rc": 127, "start": "2020-07-01 15:04:34.254490", "stderr": "/bin/sh: java: command not found", "stderr_lines": ["/bin/sh: java: command not found"], "stdout": "", "stdout_lines": []}
TASK [judgesystem7] ************************************************************
task path: /tmp/awx_849__evdvtj5/project/test/installjdk/test5/installjdk5.yml:16
skipping: [192.168.73.151] => {"changed": false, "skip_reason": "Conditional result was False"}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [192.168.73.150]: FAILED! => {"changed": false, "msg": "Could not find or access '/opt/jdk/jdk-8u131-linux-x64-replace-jce.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"}
TASK [judgesystem8] ************************************************************
task path: /tmp/awx_849__evdvtj5/project/test/installjdk/test5/installjdk5.yml:22
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [192.168.73.151]: FAILED! => {"changed": false, "msg": "Could not find or access '/opt/jdk/jdk-14.0.1_linux-x64_bin.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"}
PLAY RECAP *********************************************************************
192.168.73.150             : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=1    ignored=0   
192.168.73.151             : ok=1    changed=0    unreachable=0    failed=1    skipped=1    rescued=1    ignored=0   
EXPECTED RESULTS

What should I do? While the script is at gitthub, distribute the files from ansible's server to the remote host.

ACTUAL RESULTS
ADDITIONAL INFORMATION
thisID commented 4 years ago

github Only 100MB files are supported

AlanCoding commented 4 years ago

You could try adding the folder /opt/jdk to the setting AWX_PROOT_SHOW_PATHS

https://github.com/ansible/awx/blob/devel/awx/main/conf.py

wenottingham commented 4 years ago

We think ^ is the solution. If you're still having issues, stop by the awx-project mailing list, or the awx-devel IRC channel.