0
votes

Getting an error message when running my first playbook. I created a playbook to apply patch on multiple hosts.

---
- hosts: server01

  vars:
    jboss_home: /apps/middleware/jboss-eap-7.1
    patch_file: patch_url
    patch_dest: /apps/middleware/jboss-eap-7.1
    patch_version: 7.1.3

  tasks:

  - name: Copy patch to target host
    copy:
      src: "{{ patch_file }}"
      dest: "{{ patch_dest }}/{{ patch_file }}"

  - name: Check applied patches
    command: "jboss-cli.sh 'patch history'"
    register: result
    changed_when: "False"

  - name: Apply patch
    command: "jboss-cli.sh 'patch apply {{ patch_dest }}/{{ patch_file }}'"
    when: patch_version not in result.stdout

Output

Fatal error PLAY [server1] ****************************************************************************************** TASK [Gathering Facts] *********************************************************************************************************** ok: [server1] TASK [Copy patch to target host] ************************************************************************************************* An exception occurred during task execution. To see the full traceback, use -vvv. The error was:
/apps/middleware/ansible/environments/dev/jboss/patching/patch_url fatal: [server1]: FAILED! => {"changed": false, "msg": "Could not find or access 'patch_url'\nSearched in:\n\t/apps/middleware/ansible/environments/dev/jboss/patching/files/patch_url\n\t/apps/middleware/ansible/environments/dev/jboss/patching/patch_url\n\t/apps/middleware/ansible/environments/dev/jboss/patching/files/patch_url\n\t/apps/middleware/ansible/environments/dev/jboss/patching/patch_url"} to retry, use: --limit @/apps/middleware/ansible/environments/dev/jboss/patching/jboss_patching.retry

1
Well, the root cause of the error is written in the message Could not find or access 'patch_url' the copy module can't find this file.Baptiste Mille-Mathias
Thanks, fixed the url now i`m getting this error failed: [server1] (item=artifacts-scm.net/artifactory/middleware/jboss/jboss {"changed": false, "dest": "/apps/middleware/jboss-eap-7.1", "gid": 1041, "group": "mwadm", "item": "http net/artifactory/middleware/jboss/jboss-eap-7.1.3-patch.zip", "mode": "0775", "msg": "Request failed t>", "owner": "mwadm", "secontext": "system_u:object_r:etc_runtime_t:s0", "size": 238, "state": "director artifacts-scm.net/artifactory/middleware/jboss/…"}zungu

1 Answers

0
votes

patch_url file should be present in the files directory of your patching role. As stated in the output, that is where copy module is looking for it by default, then in the root of your role.