Skip to content

Instantly share code, notes, and snippets.

@xarses
Last active December 26, 2015 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xarses/7126943 to your computer and use it in GitHub Desktop.
Save xarses/7126943 to your computer and use it in GitHub Desktop.
Git post hook setup script.
[remote "node"]
fetch = +refs/heads/*:refs/remotes/node/*
url = ssh://10.108.3.2/root/git-repo/fuel.git
url = ssh://10.108.7.2/root/git-repo/fuel.git
url = ssh://10.108.11.2/root/git-repo/fuel.git
git push -f +ceph-rados:refs/heads/master
#!/bin/bash
download=`host -t A download.mirantis.com | awk '/has address/{print $4}'`
pubkey=`cat ~/.ssh/id_rsa.pub`
ssh -t root@$1 <<EOF
echo ${download} download.mirantis.com >>/etc/hosts
echo ${pubkey} >> ~/.ssh/authorized_keys
puppet apply -e "class {'ceph::yum':}"
yum install -y git
cd ~
mkdir -p git-repo/fuel.git
cd git-repo/fuel.git
git init --bare
mkdir /root/fuel
echo '#!/bin/sh' > hooks/post-receive
echo 'GIT_WORK_TREE=/root/fuel git checkout -f' >> hooks/post-receive
chmod +x hooks/post-receive
rm -rf /etc/puppet/modules
chmod +rx /root
ln -s /root/fuel/deployment/puppet /etc/puppet/modules
rm /etc/puppet/manifests/site.pp
ln -s /etc/puppet/modules/osnailyfacter/examples/site.pp /etc/puppet/manifests/site.pp
EOF
git remote add node ssh://root@${1}/root/git-repo/fuel.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment