Hi guys,

I am trying to execute below ansible playbook.

---
- name: "checking the java version"
  hosts: host
  remote_user: myremoteuser
  gather_facts: False
  become: yes
  become_user: serveruser
  become_method: 'sudo'

  tasks:
    - name: which java
      shell: which java
      args:
        executable: /usr/java/
      register: java
    
  
    - debug: msg="{{ java }}"
...


and getting the below error. 

FAILED! => {"changed": false, "cmd": "/usr/java/ -c 'which java'", "msg": 
"[Errno 13] Permission denied", "rc": 13} 


this is what I execute.. 


ansible-playbook -i hosts java.yml -vv --ask-become-pass


I will have to login first using "myremoteuser" and then I have to change 
the user to "serveruser" and execute the above command. 

I am able to do this directly on server but not through ansible. 


Kindly help. 


Thanks in advance,

Ruben

-- 
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/ef13bd46-3656-48c4-9a09-f6d87b6d50c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to