Sukumar
Sukumar

Reputation: 51

Adding Vagrant VM as slave in Jenkins

I'm having ubuntu 16.04 as host machine.

On the top of it, there are 2 Vagrant VMs one acts as Master and another Slave.

On Master, I have Jenkins installed and running

On slave I have Docker installed. I can do Vagrant up and Vagrant ssh and run both machines at the same time.

I need to deploy a .war file which is created in Master VM on to the Docker container which runs on the slave machine. I tried to use syncedfolder option inn Vagrant and Volume in docker. I can copy the war file to webapps directory of docker container by linking those things.

But How do I add the slave Vagrant VM as a slave node in Jenkins which is running on Master VM and deploy to docker container directly from there.

Do I need to have Jenkins installed on slave VM or anything else?

Upvotes: 1

Views: 2304

Answers (1)

yamenk
yamenk

Reputation: 51886

But How do I add the slave Vagrant VM as a slave node in Jenkins which is running on Master VM and deploy to docker container directly from there.

Do I need to have Jenkins installed on slave VM or anything else?

Adding a node as a jenkins slave to the master is well documented and you can find the solution here: How to set up new Jenkins slave. Basically, the master needs only to have ssh access and it will install the jenkins slave agent on the node.

Once you have a node registered, you can scheduel builds to run on that node, where you can pretty much do anything. You will have access to all the docker commands via the shell build steps of regular FreeStyle Jobs.

Upvotes: 1

Related Questions