Animals exhibit considerable and consistent among-individual variation in cognitive abilities, even within a population. Recent studies have attempted to address this variation using insights from the field of animal personality. Generally, it is predicted that animals with "faster" personalities (bolder, explorative, neophilic) should exhibit faster but less flexible learning. However, the empirical evidence for a link between cognitive style and personality is mixed. One possible reason for such conflicting results may be that personality-cognition covariance changes along ecological conditions, a hypothesis that has rarely been investigated so far. In this study, we tested the effect of habitat complexity on multiple aspects of animal personality and cognition, and how this influenced their relationship, in five populations of the Aegean wall lizard (Podarcis erhardii). Overall, lizards from both habitat types did not differ in average levels of personality or cognition, with the exception that lizards from more complex habitats performed better on a spatial learning task. Nevertheless, we found an intricate interplay between ecology, cognition and personality, as behavioral associations were often habitat-but also year-dependent. In general, behavioral covariance was either independent of habitat, or found exclusively in the simple, open environments. Our results highlight that valuable insights may be gained by taking ecological variation into account while studying the link between personality and cognition.