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
#!/bin/bash | |
katello-service stop | |
systemctl start postgresql | |
echo "" | |
echo "DELETING All task data" | |
echo "" | |
TABLE_COUNTS="select count(*) as foreman_tasks_tasks from foreman_tasks_tasks; |
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
#!/bin/bash | |
echo ' | |
SELECT table_name, pg_size_pretty(total_bytes) AS total | |
, pg_size_pretty(index_bytes) AS INDEX | |
, pg_size_pretty(toast_bytes) AS toast | |
, pg_size_pretty(table_bytes) AS TABLE | |
FROM ( | |
SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM ( |
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
#!/bin/bash | |
recreateq(){ | |
qpid-config --ssl-certificate=/etc/pki/katello/qpid_client_striped.crt -b amqps://localhost:5671 add queue pulp.agent.${1} --durable; | |
} | |
echo "" | |
echo "*** Clearing old qpid journal files.." | |
echo "" |
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
# EG : ALTER USER Postgres WITH PASSWORD '<newpassword>'; | |
CP_PASS=`grep jpa.config.hibernate.connection.password /etc/candlepin/candlepin.conf | awk -F= '{print $2}'` | |
F_PASS=`grep password /etc/foreman/database.yml | awk -F: '{print $2}' | sed 's/"//g'` | |
echo "ALTER USER candlepin WITH PASSWORD '$CP_PASS';" | sudo -u postgres psql | |
echo "ALTER USER foreman WITH PASSWORD '$F_PASS';" | sudo -u postgres psql |
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
#!/bin/bash | |
recreateq(){ | |
qpid-config --ssl-certificate=/etc/pki/katello/qpid_client_striped.crt -b amqps://localhost:5671 add queue pulp.agent.${1} --durable; | |
} | |
echo "" | |
echo "*** Clearing old qpid journal files.." | |
echo "" |
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
#!/bin/bash | |
pulpversion=$(rpm -qa pulp-server --queryformat "%{VERSION}") | |
yum -y install pulp-admin-client-${pulpversion} pulp-rpm-admin-extensions.noarch pulp-rpm-handlers.noarch | |
sed -i.bak "20,30s/^# host:.*/host: $(hostname -f)/g" /etc/pulp/admin/admin.conf | |
mkdir ~/.pulp | |
sudo cat /etc/pki/katello/certs/pulp-client.crt /etc/pki/katello/private/pulp-client.key > ~/.pulp/user-cert.pem | |
pulp-admin tasks list |
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
rm -rfv /etc/pki/katello{,.bak} | |
rm -rfv /etc/pki/katello-certs-tools{,.bak} | |
rm -rfv /etc/candlepin/certs/amqp{,.bak} | |
rm -rfv /etc/foreman-proxy/*ssl* | |
rm -rfv /etc/foreman/old-certs | |
rm -rfv /etc/foreman/*.pem | |
rm -rfv /var/lib/puppet/ssl | |
rm -rfv /root/ssl-build | |
satellite-installer --scenario satellite -v --certs-regenerate-ca=true --certs-regenerate=true |
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
cat <<EOF | foreman-rake console | |
persistence = ForemanTasks.dynflow.world.persistence | |
adapter = persistence.adapter | |
batch_size = 5 | |
total = adapter.db.fetch("select count(dynflow_execution_plans.uuid) from dynflow_execution_plans left join foreman_tasks_tasks on (dynflow_execution_plans.uuid = foreman_tasks_tasks.external_id) where foreman_tasks_tasks.id IS NULL").first[:count] | |
deleted = 0 | |
puts "about to delete #{total} execution plans" | |
while (plans_without_tasks = adapter.db.fetch("select dynflow_execution_plans.uuid from dynflow_execution_plans left join foreman_tasks_tasks on (dynflow_execution_plans.uuid = foreman_tasks_tasks.external_id) where foreman_tasks_tasks.id IS NULL LIMIT #{batch_size}").all.map { |x| x[:uuid] }) && !plans_without_tasks.empty? | |
persistence.delete_execution_plans({ 'uuid' => plans_without_tasks }, batch_size) |
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
#!/bin/bash | |
################################### | |
# USAGE: | |
# ./subs-export.csv.bash <ORG NAME> | |
# | |
# NOTE: If you run this without the | |
# organization name as a parameter | |
# it will return 0 results. | |
################################### |
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 all paused | |
foreman-rake foreman_tasks:cleanup TASK_SEARCH='label ~ *' AFTER='0d' STATES=paused VERBOSE=true | |
# Delete all stopped | |
foreman-rake foreman_tasks:cleanup TASK_SEARCH='label ~ *' AFTER='0d' STATES=stopped VERBOSE=true | |
# Delete everything |