Last active
December 7, 2018 13:40
-
-
Save vrillusions/7cb35a183beec5c787ba to your computer and use it in GitHub Desktop.
Purging unmanaged yumrepo resources in puppet v3.5+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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