Last active
February 13, 2019 03:05
-
-
Save kazokmr/bbe465c63c4205c61ed81759350f88df to your computer and use it in GitHub Desktop.
Vagrantを使ってJavaのWebアプリケーション実行サーバーとJenkinsサーバーを同時に設定する
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "centos/7" | |
config.vm.box_check_update = false | |
config.vm.synced_folder "ansible-java-deploy-env","/ansible",:mount_options => ['dmode=775','fmode=664'] | |
config.vm.define :jenkins do | jenkins | | |
jenkins.vm.hostname = "jenkins" | |
jenkins.vm.network :private_network, ip: "192.168.33.10" | |
# jenkins.vm.memory = "2048" | |
jenkins.vm.provision "shell", inline: $script | |
jenkins.vm.provision "shell", inline: $build_jenkins | |
end | |
config.vm.define :jvm do | jvm | | |
jvm.vm.hostname = "jvm" | |
jvm.vm.network :private_network, ip: "192.168.33.20" | |
# jvm.vm.memory = "1024" | |
jvm.vm.provision "shell", inline: $script | |
jvm.vm.provision "shell", inline: $build_jvm | |
end | |
config.vm.define :tomcat do | tomcat | | |
tomcat.vm.hostname = "tomcat" | |
tomcat.vm.network :private_network, ip: "192.168.33.30" | |
# tomcat.vm.memory = "1024" | |
tomcat.vm.provision "shell", inline: $script | |
tomcat.vm.provision "shell", inline: $build_tomcat | |
end | |
end | |
$script = <<END | |
if ! [`which ansible`]; then | |
yum -y install epel-release | |
# サーバーによってはCコンパイラがインストールされていなくてmakeが実行できない | |
yum -y install gcc | |
yum -y install ansible | |
fi | |
END | |
$build_jenkins = <<END | |
ansible-playbook -i /ansible/jenkins /ansible/jenkins-site.yml | |
END | |
$build_jvm = <<END | |
ansible-playbook -i /ansible/jvm /ansible/jvm-site.yml | |
END | |
$build_tomcat = <<END | |
ansible-playbook -i /ansible/tomcat /ansible/tomcat-site.yml | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment