I think the problem is that when you execute 'su admin' this command is executed in its own subshell. After the command you are dropped back into you script and you lost everything which was done in that subshell. It is almost the same as what you say, the result is equal anyway.
But why not execute you entire script as admin is you need admin privileges on the box you are running that script?
You can also try to add the ssh command to the 'su' command:
It is not fully clear to me why you use the command 'become'. Anyway you would have to supply a password isn it?
And if you need admin privileges on the box you are connecting to, you can use:
ssh -l another_user myhost.com
Many boxes have excluded root from ssh access, so you would have to ssh first
to the host, and then
If you want to script your ssh commands on the other box as well that can become complicated. You'd have to write a so-called here document