zungu
zungu

Reputation: 1

Error when running playbook

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

Upvotes: 0

Views: 1250

Answers (1)

blakelead
blakelead

Reputation: 1890

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.

Upvotes: 0

Related Questions