This thesis focuses on flexibility in distributed IT infrastructure for administrators and users. From users point of view, they need on-demand resources fitting their application needs. For administrators, they set policies for resource allocation (policies for resource usage and safety) in order to meet the user application needs. We studied the issue of flexibility in the context of grids and clouds. First, we designed and implemented the Saline system. Saline is based on virtualization technology for the execution of besteffort jobs in grids. We also proposed the Grillade system which combines flexibility mechanisms provided by grids and clouds. This allow, firstly, to dynamically extend a grid with virtual resources provided by a cloud...