This snippet uses the wpseo_robots filter to add a "noindex, follow" to posts that match a certain condition (in this example, is_single()).
add_filter( 'wpseo_robots', function ( $robots ) {
if ( is_single() ) {
return 'noindex,follow';
}
return $robots;
});