What are the roles of pyridine and DCM in the acylation of an alcohol?
Dichloromethane (DCM) is a common organic solvent and this is its role in both reactions (and in most cases where it is used). The first reaction is indeed the conversion of a carboxylic acid to an acyl chloride. The DMF is a catalyst and the reactions proceeds through an imidoyl chloride intermediate, $\ce{Me2N+=CHCl}$.

Pyridine is a weak base, with a $\mathrm{p}K_\mathrm{aH}$ of 5.21 and it is often used to remove extra protons during the course of a reaction. It is also a good nucleophile for attacking carbonyl groups to activate them towards attack by other, less good nucleophiles (thanks to @orthocresol and @DGS for pointing this out). In this reaction it serves both these purposes.



An acid anhydride can also be used as the acylating agent. The principle is the same: pyridine acts as a nucleophilic catalyst and generates the same intermediate as above.