Skip to content

Instantly share code, notes, and snippets.

@adamruzicka
Created September 3, 2017 21:45
Show Gist options
  • Save adamruzicka/32a55ebd9da09d4f65464217ae05316c to your computer and use it in GitHub Desktop.
Save adamruzicka/32a55ebd9da09d4f65464217ae05316c to your computer and use it in GitHub Desktop.
Deploy async-ssh onto a fresh satellite 6.3
#!/bin/bash
set -x
function store_repository_state() {
if [ -d '.git' ]; then
report ".git is already present, skipping"
else
report "Saving repository state"
git init
git add .
git commit -m rpm
fi
}
function heading() {
local message="$1"
echo "* $message"
}
function report() {
local message="$1"
echo " -> $message"
}
function add_remote() {
local remote_name="$1"
local remote_path="$2"
report "Adding remote $remote_name from $remote_path"
git remote add "$remote_name" "$remote_path"
git fetch "$remote_name"
}
function cd_echo() {
heading "In $1"
cd "$1"
}
#
# foreman-tasks-core
#
cd_echo /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-core-0.1.4/
store_repository_state
add_remote upstream https://github.com/theforeman/foreman-tasks
git cherry-pick f6cfa9f77b74dc034306a4c6bee4ef3c368d139e
git cherry-pick 45d38ee83c0478fd8511330b34c7a58ab60119eb
#
# foreman_remote_execution
#
cd_echo /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-1.3.3/
store_repository_state
add_remote aruzicka https://github.com/adamruzicka/foreman_remote_execution
git checkout async-ssh
#
# foreman_remote_execution_core
#
cd_echo /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution_core-1.0.5/
store_repository_state
add_remote aruzicka https://github.com/adamruzicka/foreman_remote_execution
git checkout async-ssh
#
# smart_proxy_dynflow_core
#
cd_echo /opt/theforeman/tfm/root/usr/share/gems/gems/smart_proxy_dynflow_core-0.1.6/
store_repository_state
add_remote aruzicka https://github.com/adamruzicka/smart_proxy_dynflow
git checkout async-ssh
report "Fixing Gemfile.in"
git checkout master -- Gemfile.in
#
# smart_proxy_dynflow
#
cd_echo /usr/share/gems/gems/smart_proxy_dynflow-0.1.6/
store_repository_state
add_remote aruzicka https://github.com/adamruzicka/smart_proxy_dynflow
git checkout async-ssh
#
# smart_proxy_remote_execution_ssh
#
cd_echo /usr/share/gems/gems/smart_proxy_remote_execution_ssh-0.1.5/
store_repository_state
add_remote aruzicka https://github.com/adamruzicka/smart_proxy_remote_execution_ssh
git checkout async-ssh
report "Enabling async_ssh in /etc/smart_proxy_dynflow_core/settings.d/remote_execution_ssh.yml"
echo ':async_ssh: true' >> /etc/smart_proxy_dynflow_core/settings.d/remote_execution_ssh.yml
report "Enabling DEBUG log level in /etc/smart_proxy_dynflow_core/settings.yml"
sed -i 's/^# :log_level.*/:log_level: DEBUG/' /etc/smart_proxy_dynflow_core/settings.yml
heading "Forcing puppet to send facts"
puppet agent --test
heading "Restarting services"
systemctl restart smart_proxy_dynflow_core
systemctl restatr foreman-proxy
heading "Setting up ssh keys"
mkdir -p ~/.ssh
cat ~foreman-proxy/.ssh/id_rsa_foreman_proxy.pub >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh/
chmod 600 ~/.ssh/authorized_keys
heading "Done, please trigger a job on this host and watch /var/log/foreman-proxy/smart_proxy_dynflow_core.log"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment