Move check for accelerate mode deeper to account for ansible_connection

Fixes #4045