We demonstrate the use of the 'Direct-Adjoint-Looping method' for the identification of optimal buoyancy-driven ventilation flows governed by Boussinesq equations. We use the incompressible Reynoldsaveraged Navier-Stokes (RANS) equations, derive the corresponding adjoint equations and solve the resulting sensitivity equations with respect to inlet conditions. We focus on a displacement ventilation scenario with a steady plume due to a line source. Subject to an enthalpy flux constraint on the incoming flow, we identify boundary conditions leading to 'optimal' temperature distributions in the occupied zone. Our results show that depending on the scaled volume and momentum flux of the inlet flow, qualitatively different flow regimes may be obtained. The numerical optimal results agree with analytically obtained optimal inlet conditions available from classical plume theory in an 'intermediate' regime of strong stratification and two-layer flow.