The following playbook doesn't do what I think it should. The su on the task stays as root.

I was asked to file a bug; I could still do so. But if you think you have a handle on it, then it might just be better to past this here.

cmd: ansible-playbook -i hosts.txt su-for-task-broken.yml -vvvv

== hosts.txt
localhost               ansible_ssh_pass=xxxxxxxx current_user=adam
== su-for-task-broken.yml
- hosts: localhost
  remote_user: root
  tasks:
    - name: sudo test
      sudo: true
      sudo_user: "{{ current_user }}"
      shell: whoami
      register: sudo_test_result

    - name: su test
      su: true
      su_user: "{{ current_user }}"
      shell: whoami
      register: su_test_result

    - name: debug
      debug: var=sudo_test_result

    - name: sudo test check
      fail: msg="sudo didn't change to the correct user"
      when: sudo_test_result.stdout != current_user

    - name: su test check
      fail: msg="su didn't change to the correct user"
      when: sudo_test_result.stdout != current_user
==

On 01/24/2014 09:46 AM, Matt Martz wrote:
I'm looking at this as well, and believe that I may have identified and
fixed the issue. I'm going to talk it over with Paul (angstwad) for
validation and testing.
--
Matt Martz
[email protected]

--
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to