-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
287 additions
and
151 deletions.
There are no files selected for viewing
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
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
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
case "$1" in | ||
"kvm-control" ) | ||
project=$(sudo su - rundeck -c "rd projects list |grep $1") | ||
if [[ -z "$project" ]]; then | ||
echo -e "Creating $1 project and jobs!\n" | ||
sudo su rundeck -c "rd projects create -p kvm-control" | ||
sudo su rundeck -c "rd jobs load -r -f $2/rundeck_jobs.xml -p kvm-control" | ||
else | ||
echo -e "$1 project and jobs already created!\n" | ||
fi | ||
;; | ||
"kvm-control_with-Chef" ) | ||
project=$(sudo su - rundeck -c "rd projects list |grep $1") | ||
if [[ -z "$project" ]]; then | ||
echo -e "Creating $1 project and jobs!\n" | ||
sudo su rundeck -c "rd projects create -p kvm-control_with-Chef -- --resources.source.2.config.url=http://localhost:9980 --resources.source.2.type=url --resources.source.2.config.timeout=60 --resources.source.2.config.cache=false" | ||
sudo su rundeck -c "rd jobs load -r -f $2/chef-rundeck_jobs.xml -p kvm-control_with-Chef" | ||
else | ||
echo -e "$1 project and jobs already created!\n" | ||
fi | ||
;; | ||
"docker-control" ) | ||
project=$(sudo su - rundeck -c "rd projects list |grep $1") | ||
if [[ -z "$project" ]]; then | ||
echo -e "Creating $1 project and jobs!\n" | ||
sudo su rundeck -c "rd projects create -p docker-control" | ||
sudo su rundeck -c "rd jobs load -r -f $2/rundeck_jobs.xml -p docker-control" | ||
else | ||
echo -e "$1 project and jobs already created!\n" | ||
fi | ||
;; | ||
"chef_server-control" ) | ||
project=$(sudo su - rundeck -c "rd projects list |grep $1") | ||
if [[ -z "$project" ]]; then | ||
echo -e "Creating $1 project and jobs!\n" | ||
sudo su rundeck -c "rd projects create -p chef_server-control" | ||
sudo su rundeck -c "rd jobs load -r -f $2/rundeck_jobs-chef.xml -p chef_server-control" | ||
else | ||
echo -e "$1 project and jobs already created!\n" | ||
fi | ||
;; | ||
esac |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
|
||
case "$1" in | ||
"rundeck-cli" ) | ||
file=$(ls /etc/apt/sources.list.d/ |grep rundeck-cli.list) | ||
if [[ -z "$file" ]]; then | ||
echo -e "Downloading $1!\n" | ||
echo "deb https://dl.bintray.com/rundeck/rundeck-deb /" | sudo tee -a /etc/apt/sources.list.d/rundeck-cli.list | ||
curl "https://bintray.com/user/downloadSubjectPublicKey?username=bintray" > /tmp/bintray.gpg.key | ||
apt-key add - < /tmp/bintray.gpg.key | ||
apt-get -y install apt-transport-https | ||
apt-get -y update | ||
else | ||
echo -e "$1 is already on this server!\n" | ||
fi | ||
;; | ||
"rundeck" ) | ||
file=$(ls |grep rundeck-$2-GA.deb) | ||
if [[ -z "$file" ]]; then | ||
echo -e "Downloading $1!\n" | ||
wget http://download.rundeck.org/deb/rundeck-$2-GA.deb | ||
dpkg -i rundeck-$2-GA.deb | ||
rm -rf /tmp/rundeck/ | ||
cp /etc/rundeck/rundeck-config.properties /etc/rundeck/rundeck-config.properties.backup | ||
cp /etc/rundeck/framework.properties /etc/rundeck/framework.properties.backup | ||
else | ||
echo -e "$1 is already on this server!\n" | ||
fi | ||
;; | ||
"mysql-connector" ) | ||
file=$(ls |grep mysql-connector-java-5.1.40.tar.gz) | ||
if [[ -z "$file" ]]; then | ||
echo -e "Downloading $1!\n" | ||
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.40.tar.gz | ||
tar -zxf mysql-connector-java-5.1.40.tar.gz -C /tmp/ | ||
cp /tmp/mysql-connector-java-5.1.40/mysql-connector-java-5.1.40-bin.jar /var/lib/rundeck/libext/ | ||
else | ||
echo -e "$1 is already on this server!\n" | ||
fi | ||
;; | ||
"chef-rundeck" ) | ||
file=$(ls |grep ruby-ffi) | ||
if [[ -z "$file" ]]; then | ||
echo -e "Downloading ffy dependencies and chef-rundeck gem!\n" | ||
wget http://mirrors.kernel.org/ubuntu/pool/universe/r/ruby-ffi/ruby-ffi_1.9.10debian-1build2_amd64.deb http://security.ubuntu.com/ubuntu/pool/universe/r/ruby-ffi-yajl/ruby-ffi-yajl_2.2.3-2_amd64.deb | ||
sudo dpkg -i ruby-ffi* | ||
sudo gem install chef-rundeck | ||
else | ||
echo -e "$1 and its dependencies are already installed on this server!\n" | ||
fi | ||
;; | ||
esac |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
#!/bin/bash | ||
|
||
echo -e "Installing Docker...\n" | ||
sudo apt-get -y install docker.io | ||
sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker | ||
sudo docker pull ubuntu:14.04 | ||
sudo adduser rundeck docker | ||
sudo mkdir -p $1 | ||
cp docker/rundeck_jobs.xml $1 | ||
sudo chown rundeck. -R $1 | ||
containers_running=`sudo docker ps |grep -v CONTAINER` | ||
if [[ -z "$containers_running" ]]; then | ||
sudo service docker.io restart | ||
echo -e "Restarting Docker service...\nWaiting 5 seconds for Docker to start..." | ||
sleep 5 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,41 @@ | ||
#!/bin/bash | ||
sudo mkdir -p $3/$1/logs | ||
chef_up=`sudo docker ps -a |grep -v CONTAINER |grep $1` | ||
chef_present=$(sudo docker ps -a |grep $1) | ||
chef_up=$(sudo docker ps |grep $1) | ||
set -e | ||
if [[ -z "$chef_up" ]]; then | ||
sudo docker run --privileged -e CHEF_PORT=$2 --name $1 -d -v $3/$1/logs/chef-logs:/var/log -v $3/$1/logs/install-chef-out:/root -p $2:$2 cbuisson/chef-server | ||
else | ||
echo -e "\nThere is already a Docker container named: $1\nRemove it first and re-run that script if you want a new container!\n" | ||
fi | ||
sudo scripts/check_url.sh https://$4:$2/knife_admin_key.tar.gz 300 | ||
sudo curl -o $3/$1/knife_admin_key.tar.gz -Ok https://$4:$2/knife_admin_key.tar.gz | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -q -y ruby1.9.1-dev chef | ||
knife_keys=( /var/lib/rundeck ~ ) | ||
for i in "${knife_keys[@]}" | ||
do | ||
mkdir -p $i/.chef | ||
cat > $i/.chef/knife.rb << EOL | ||
if [[ -z "$chef_present" ]]; then | ||
echo -e "Downloading container and start $1\n" | ||
sudo mkdir -p $3/$1/logs | ||
docker pull cbuisson/chef-server:v2.2 | ||
sudo docker run --privileged -e CONTAINER_NAME=$1 -e CHEF_PORT=$2 --name $1 -d -v $3/$1/logs/chef-logs:/var/log -v $3/$1/logs/install-chef-out:/root -p $2:$2 cbuisson/chef-server:v2.2 | ||
docker_ip=$(sudo docker inspect -f '{{.NetworkSettings.IPAddress }}' $1) | ||
grep -q "$docker_ip $1" /etc/hosts || echo "$docker_ip $1" | sudo tee -a /etc/hosts | ||
sudo scripts/check_url.sh https://$1:$2/knife_admin_key.tar.gz 600 | ||
sudo curl -o $3/$1/knife_admin_key.tar.gz -Ok https://$1:$2/knife_admin_key.tar.gz | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -q -y chef | ||
knife_keys=( /var/lib/rundeck ~ ) | ||
for i in "${knife_keys[@]}" | ||
do | ||
mkdir -p $i/.chef | ||
cat > $i/.chef/config.rb << EOL | ||
log_level :info | ||
log_location STDOUT | ||
cache_type 'BasicFile' | ||
node_name 'admin' | ||
client_key '$i/.chef/admin.pem' | ||
validation_client_name 'chef-validator' | ||
validation_key '$i/.chef/chef-validator.pem' | ||
chef_server_url 'https://$4:$2' | ||
chef_server_url 'https://$1:$2/organizations/my_org' | ||
EOL | ||
sudo tar -zxf $3/$1/knife_admin_key.tar.gz -C $i/.chef/ | ||
done | ||
sudo chown rundeck. -R $3/$1 | ||
echo -e "\n\e[1mCreating knife keys for rundeck and $SUDO_USER users!\e[0m" | ||
sudo chown rundeck. -R /var/lib/rundeck/.chef/ | ||
sudo chown $SUDO_USER. -R ~/.chef/ | ||
sudo tar -zxf $3/$1/knife_admin_key.tar.gz -C $i/.chef/ | ||
done | ||
knife ssl fetch | ||
knife user list | ||
sudo su - rundeck -c "knife ssl fetch && knife user list" | ||
sudo chown rundeck. -R $3/$1 | ||
echo -e "\n\e[1mCreating knife keys for rundeck and $SUDO_USER users!\e[0m" | ||
sudo chown rundeck. -R /var/lib/rundeck/.chef/ | ||
sudo chown $SUDO_USER. -R ~/.chef/ | ||
elif [[ -z "$chef_up" ]]; then | ||
echo -e "Starting $1 container\n" | ||
sudo docker start $1 | ||
else | ||
echo -e "\nThere is already a Docker container named: $1\nRemove it first and re-run that script if you want a new container!\n" | ||
fi |
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
Oops, something went wrong.