Running Ansible 2.1. If I use sudo in front of the command, it works. if I 
remove and use "become_user: root" it does not work. I've also tried 
setting "become: True" and I get the same results.

Works:

- name: restart web server
  shell: sudo /etc/init.d/aria_services restart
  when: install_rpm_results|success
  register: restart_services_result
  failed_when: "'FAIL' in restart_services_result.stdout"
  ignore_errors: True


Expected Results:

"stdout": "Creating /web bind mounts\n=== stop ===\n== no PID means no KILL 
==\nClearing wsdl and symfony cache files\n=== start ===\nQuery API OK\nNGUI 
API OK\nCore API OK\nAdmin API OK\nFailed ARC/VIE API\n2 attempted: 2 started, 
2 stopped",
        "stdout_lines": [
            "Creating /web bind mounts",
            "=== stop ===",
            "== no PID means no KILL ==",
            "Clearing wsdl and symfony cache files",
            "=== start ===",
            "Query API OK",
            "NGUI API OK",
            "Core API OK",
            "Admin API OK",
            "Failed ARC/VIE API",
            "2 attempted: 2 started, 2 stopped"
        ],



Does not work:

- name: restart web server
  shell: /etc/init.d/aria_services restart
  when: install_rpm_results|success
  register: restart_services_result
  failed_when: "'FAIL' in restart_services_result.stdout"
  ignore_errors: True
  become_user: root


Actual Results:

"stderr": "Password: su: Authentication information cannot be recovered\ncat: 
/etc/aria/services: Permission denied",
        "stdout": "No aria services found",



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c62d4969-4394-4f79-a13b-9a31b6c472c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to