Did something change with how handlers are invoked?

Today's git pull of devel and all my handlers that need to run as root are 
failing.

$ ansible --version
ansible 2.2.0 (devel 19e00cf160) last updated 2016/09/09 11:04:47 (GMT -500)
  lib/ansible/modules/core: (detached HEAD bf5b3de83e) last updated 
2016/09/09 11:04:47 (GMT -500)
  lib/ansible/modules/extras: (detached HEAD f83aa9fff3) last updated 
2016/09/09 11:04:47 (GMT -500)
  config file = /Users/tanner/projects/ansible.git/playbooks.git/ansible.cfg
  configured module search path = Default w/o overrides

- hosts: all
  roles:
    - { role: grub2, become: yes }

grub2 handlers/main.yml

- name: update grub2
  command: "{{ update_grub2_command }}"
  register: r
  failed_when: r.rc != 0
  changed_when: False
  tags: grub2

RUNNING HANDLER [grub2 : update grub2] 
*****************************************
fatal: [testing_xenial64]: FAILED! => {"changed": false, "cmd": 
["/usr/sbin/update-grub2"], "delta": "0:00:00.011241", "end": "2016-09-09 
12:06:25.551493", "failed": true, "failed_when_result": true, "rc": 1, 
"start": "2016-09-09 12:06:25.540252", "stderr": "grub-mkconfig: You must 
run this as root", "stdout": "", "stdout_lines": [], "warnings": []}

Changing the handler to

- name: update grub2
  command: "{{ update_grub2_command }}"
  register: r
  failed_when: r.rc != 0
  changed_when: False
*  become: yes*
  tags: grub2

Fixes the problem.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to