Created
October 26, 2016 13:58
-
-
Save jnikolak/eb4675eabc60d02743e4ba6ebe2c18b4 to your computer and use it in GitHub Desktop.
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
#DELETE DUPLICATES | |
# Locate hosts in katello_systems and order themn | |
su - postgres -c "psql foreman -c \"select uuid,id from katello_systems ORDER BY uuid asc;\"" >/tmp/uuid.out | |
# In above we have 396 Duplicates Content hosts | |
# Take that data and uniquely sort out | |
sort | uniq -d -w 36 /tmp/uuid.out | wc -l | |
396 | |
# Then we can awk the file to get the id only. | |
uniq -d -w 36 /tmp/uuid.out | awk '{print $3}' > unique_id.out | |
# Then we can use hammer | |
for i in $(cat unique_id.out); do hammer content-host delete --id $i;done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment