Hello,
I hope someone can answer this. I have a bunch of commands (shell scripts ) 
in a specific directory I need to run as root user. So I do:

- name: Becoming root
   command: sudo su -

- name: Changing directory
  command: cd "{{ command_directory }}"

- name: Sourcing commands 
  command: source mycommand.sh


The problem is keep getting:
fatal: [127.0.0.1]: FAILED! => {"changed": false, "cmd": "cd 
full_path_to_my_command_directory", "failed": true, "msg": "[Errno 2] No 
such file or directory", "rc": 2}

If I do manually, it works fine. 

Any suggestions? I have tried become but exactly the same result. It just 
seems like once I change to root, cd command does not work anymore. 

Thanks and regards
Charles



-- 
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/d33d5d14-9f51-4e40-891b-b29b54004b89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to