In this paper we study the most general covariant action of gravity up to terms that are quadratic in curvature. In particular this includes non-local, infinite derivative theories of gravity which are ghost-free and exhibit asymptotic freedom in the ultraviolet. We provide a detailed algorithm for deriving the equations of motion for such actions containing an arbitrary number of the covariant D'Alembertian operators, and this is our main result. We also perform a number of tests on the field equations we derive, including checking the Bianchi identities and the weak-field limit. Lastly, we consider the special subclass of ghost and asymptotically free theories of gravity by way of an example.