Created
November 4, 2018 09:45
-
-
Save mlabouardy/4ba673e47ca3b1ec755614d99359f877 to your computer and use it in GitHub Desktop.
provision jenkins instance
This file contains hidden or 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 "Install Jenkins stable release" | |
yum remove -y java | |
yum install -y java-1.8.0-openjdk | |
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | |
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key | |
yum install -y jenkins | |
chkconfig jenkins on | |
echo "Install Telegraf" | |
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.6.0-1.x86_64.rpm -O /tmp/telegraf.rpm | |
yum localinstall -y /tmp/telegraf.rpm | |
rm /tmp/telegraf.rpm | |
chkconfig telegraf on | |
mv /tmp/telegraf.conf /etc/telegraf/telegraf.conf | |
service telegraf start | |
echo "Install git" | |
yum install -y git | |
echo "Setup SSH key" | |
mkdir /var/lib/jenkins/.ssh | |
touch /var/lib/jenkins/.ssh/known_hosts | |
chown -R jenkins:jenkins /var/lib/jenkins/.ssh | |
chmod 700 /var/lib/jenkins/.ssh | |
mv /tmp/id_rsa /var/lib/jenkins/.ssh/id_rsa | |
chmod 600 /var/lib/jenkins/.ssh/id_rsa | |
echo "Configure Jenkins" | |
mkdir -p /var/lib/jenkins/init.groovy.d | |
mv /tmp/basic-security.groovy /var/lib/jenkins/init.groovy.d/basic-security.groovy | |
mv /tmp/disable-cli.groovy /var/lib/jenkins/init.groovy.d/disable-cli.groovy | |
mv /tmp/csrf-protection.groovy /var/lib/jenkins/init.groovy.d/csrf-protection.groovy | |
mv /tmp/disable-jnlp.groovy /var/lib/jenkins/init.groovy.d/disable-jnlp.groovy | |
mv /tmp/jenkins.install.UpgradeWizard.state /var/lib/jenkins/jenkins.install.UpgradeWizard.state | |
mv /tmp/node-agent.groovy /var/lib/jenkins/init.groovy.d/node-agent.groovy | |
chown -R jenkins:jenkins /var/lib/jenkins/jenkins.install.UpgradeWizard.state | |
mv /tmp/jenkins /etc/sysconfig/jenkins | |
chmod +x /tmp/install-plugins.sh | |
bash /tmp/install-plugins.sh | |
service jenkins start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment