Playbook issue

42 views
Skip to first unread message

harold....@climate.com

unread,
Mar 24, 2016, 9:40:15 AM3/24/16
to Ansible Project

I am running a playbook that is included as part of another playbook but I keep getting an error, can I get some help debugging it. Here is the job:

---

  - name: Clean yum

     action: shell yum clean all

  - name: Clean cache

     yum: name=* update_cache=yes state=latest

  - name: Apply All OS Patches

     yum: name=* state=latest

     notify:

     - reboot

     - reboot_complete

  handlers:

  - name: reboot

     command: reboot "Ansible triggered reboot"

     async: 0

     poll: 0

     ignore_errors: true

  - name: reboot_complete

     local_action: wait_for host={{ inventory_hostname }}




Here is the error that I keep seeing

fatal: [10.193.1.129]: FAILED! => {"failed": true, "reason": "Syntax Error while loading YAML.\n\n\nThe error appears to have been in '/var/lib/awx/projects/it_security/baseline/tasks/update_redhat.yml': line 14, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n handlers:\n ^ here\n"}


It shows the error in the line handlers and I've tried to move it around some to make sure it's not a spacing issue but I keep getting the same issue.

harold....@climate.com

unread,
Mar 24, 2016, 10:08:03 AM3/24/16
to Ansible Project
I found the root of this problem.  You can not notify handlers that are defined inside of an include.  I believe I can define the handlers in the  main.yml and then call them from the include though.

Johannes Kastl

unread,
Mar 24, 2016, 10:16:58 AM3/24/16
to ansible...@googlegroups.com
Am 24.03.16 schrieb harold....@climate.com:


> *I am running a playbook that is included as part of another playbook but I
> keep getting an error, can I get some help debugging it. Here is the job:*
> It shows the error in the line handlers and I've tried to move it around
> some to make sure it's not a spacing issue but I keep getting the same
> issue.

I am new to ansible, so the old syntax looks a little bit different to
me. But I would put the handlers in the handlers subdirectory of your
baseline folder.

Johannes



signature.asc
Reply all
Reply to author
Forward
0 new messages