Issue with become_user

Hey all. I’m attempting to write a small playbook that installs oh-my-zsh on a remote host. The final step of the playbook is to run the ohmyzsh install tool script.

The problem is that is installing the configurations at /root/.oh-my-zsh instead of the desirable /home/ec2-user/.oh-my-zsh. Am I doing something wrong here?

If I log into the remote instance and run that shell command manually, all is well - the configurations end up in /home/ec2-user/.oh-my-zsh.

However, when I attempt to do it through Ansible and this task, the configurations end up in /root/.oh-my-zsh instead of /home/ec2-user/.oh-my-zsh.

Any thoughts on what I’m doing wrong? In my hosts file, my “ansible_user” is set to “ec2-user” , so that’s the only thing I could think of that could be causing an issue.
If anyone can point me in the right direction I’d appreciate it!

Thanks.

-Ryan

become_user does not imply become: true

You will also need to instruct ansible to actually use become.