Skip to content

Instantly share code, notes, and snippets.

View sayan3296's full-sized avatar

Sayan Das sayan3296

  • Red Hat Inc.
  • Pune, India
  • 06:04 (UTC +05:30)
View GitHub Profile
@sayan3296
sayan3296 / set_content.sh
Created March 3, 2023 11:17
Run SetContent task for all the ContentView Environments
cat << EOF | foreman-rake console
Katello::ContentViewEnvironment.all.each do |cve|
ForemanTasks.async_task(
Actions::Candlepin::Environment::SetContent,
cve.content_view,
cve.owner,
cve,
)
end
EOF
@sayan3296
sayan3296 / tmux-logging.sh
Created March 1, 2023 12:27
Script to log tmux sesstion output in a file
#!/bin/bash
# To enable screen logging press: Ctrl + b followed by H
grep -q tmux.log 2>/dev/null ~/.tmux.conf || cat << _EOF >> ~/.tmux.conf
bind-key H pipe-pane -o "exec cat >>$HOME/'#W-tmux.log'" \; display-message 'Toggled logging to $HOME/#W-tmux.log'
_EOF
tmux new -s tmux-logged
@sayan3296
sayan3296 / cv_report.sh
Last active February 7, 2023 11:31
Find package information from published version of the CVs across all environment
#!/bin/bash
# Criteria:
# Expected Column of the report:
#
# CV, CV Version, Lifecycle, Latest Kernel Package in the version
#
# Considerations:
#
# We will only choose those CV versions that have any lifecycle promoted to it.
@sayan3296
sayan3296 / parser_cache_installer_breakfix.yml
Last active December 31, 2022 11:18
satellite-installer fails with parser cache error
Requirements:
* Satellite 6.10 ( latest minor release ) installed on RHEL 7
* Organization RedHat and Location GSS
* No Repo content is required to be enabled\synced
Breakfix Playbook:
~~~
---
@sayan3296
sayan3296 / host_missing_foreman_breakfix.yml
Last active December 31, 2022 11:04
satellite-fqdn host entry missing from Foreman - breakfix
Requirements:
* Satellite 6.11 ( latest minor release ) installed on RHEL 7 or RHEL 8
* Organization RedHat and Location GSS
* No contents\repo\manifest required
Breakfix Playbook:
~~~
---
@sayan3296
sayan3296 / candlepin_events_breakfix.yml
Last active December 30, 2022 10:00
Error with STOMP client and port 61613 for candlepin
Requirements:
* Satellite 6.10 ( latest minor release ) installed on RHEL 7
* Organization RedHat and Location GSS
Breakfix Playbook:
~~~
---
- name: Creating breakfix for candlepin_events failure in Satellite 6.10
@sayan3296
sayan3296 / downloaded_content_size.sh
Created November 24, 2022 19:56
Collect list of synced repos and size of stored\downloaded contents in pulp for them
#!/bin/bash
export path_of_repos=''
path_of_repos=$(echo "COPY (select base_path from core_distribution) TO STDOUT;" | su - postgres -c "psql pulpcore")
for repo in $path_of_repos
do
echo "COPY(select core_d.base_path,cpa.relative_path,ca.file from core_distribution as core_d RIGHT JOIN core_publication as cp ON core_d.publication_id=cp.pulp_id LEFT JOIN core_publishedartifact as cpa ON cp.pulp_id=cpa.publication_id LEFT JOIN core_contentartifact as core_ca ON core_ca.pulp_id=cpa.content_artifact_id LEFT JOIN core_artifact as ca ON ca.pulp_id=core_ca.artifact_id where core_d.base_path = '$repo' order by core_d.base_path) TO STDOUT WITH CSV" | su - postgres -c "psql pulpcore"
done > /tmp/repo_to_artifact.txt
* Satellite 6.10+ is already installed and having an activation key created to register a system
* The client host has been registered with satellite , associated with "Default Organization view" CV + "Library" lifecycle and has been populated with remote execution ssh keys from satellite's foreman-proxy user.
i.e. Satellite should be able to run any commands, playbook, role etc. on this system via remote execution.
Manual Reproducer:
-----------
On the client system:
@sayan3296
sayan3296 / rhel_6_els_cert_deploy.sh
Created November 2, 2022 21:39
To deploy ELS product certs on RHEL 6 systems
#!/bin/bash
# Create directory /etc/pki/product/.
mkdir -p /etc/pki/product/
# Remove existing 69.pem files
[ -f /etc/pki/product-default/69.pem ] && rm -f /etc/pki/product-default/69.pem
[ -f /etc/pki/product/69.pem ] && rm -f /etc/pki/product-default/69.pem
sleep 3
@sayan3296
sayan3296 / breakfix_qpidd_not_starting.sh
Last active October 29, 2022 14:06
Qpidd service not starting due to sudo errors ( case 03347873 )
#!/bin/bash
#
## Assuming satellite 6.10 or 6.11 is installed with organization name RedHat.
## Also the "strace" package should be installed on the satellite server OS
for i in KATELLO_AGENT_STAT QPID_STAT; do unset $i; done
KATELLO_AGENT_STAT=$(awk '/enable_katello_agent:/{print $NF}' /etc/foreman-installer/scenarios.d/satellite-answers.yaml)
if [[ $KATELLO_AGENT_STAT = "false" ]]