The stellar and hot gas content of low-mass galaxy clusters