What are the roles of pyridine and DCM in the acylation of an alcohol? What role does pyridine and $\ce{CH2Cl2}$ play in this reaction?



(Prior to this step, the corresponding carboxylic acid was converted to the acyl chloride using DMF, oxalyl chloride, and DCM.)

This reaction is taken from Bear, R. B.; Shea, K. J. Tandem Hetero Diels−Alder Reaction: Synthesis of Oxygenated Macrocycles. Org. Lett. 2001, 3 (5), 723–726. DOI:10.1021/ol007040s..
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.