As was advised, it's better manage the whole repository, using puppet/yum
module for example.
You can manage some of the feature of the repo, this way:
yumrepo { 'HighAvailability':
descr => 'name=CentOS-$releasever - HA',
enabled => '1',
target => '/etc/yum.repos.d/CentOS-HA.repo',
}
--
As stated above if you match the existing file with a yumrepo resource then
yes it will effectively change just the file but puppet will now own that
so it has to match or else it will create a new file.
So if the existing file looks like this...
[BaseOS]
name=CentOS-$releasever - Base
mirrorli