Skip to content

Instantly share code, notes, and snippets.

@vrillusions
Last active December 7, 2018 13:40
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrillusions/7cb35a183beec5c787ba to your computer and use it in GitHub Desktop.
Save vrillusions/7cb35a183beec5c787ba to your computer and use it in GitHub Desktop.
Purging unmanaged yumrepo resources in puppet v3.5+
# This was tested on puppet v3.6.1 but believe the fix was in v3.5
yumrepo { 'epel':
ensure => present,
baseurl => 'http://whatever'
...
}
# This purges any yumrepo resource that isn't specified anywhere in manifest.
# On node run `puppet resource yumrepo` to get a list of all yumrepo resources
# puppet sees on node even if not defined in manifest
resources { 'yumrepo':
purge => true,
}
# ----- IMPORTANT IMPORTANT IMPORTANT -----
# do not purge the directory like this:
file { '/etc/yum.repos.d':
ensure => directory,
force => true,
purge => true,
recurse => true,
}
# as that will remove all yumrepo resources. The fix pre v3.5 was to create file resources for each repo.
# that would still work but above method is better
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment