A former Army soldier who suffers from complex post-traumatic stress disorder (PTSD) has avoided being sent to prison for attacking a hotel housing asylum seekers.