HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

How to start a VPN connection using Jenkins?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
vpnhowjenkinsusingstartconnection

Problem

I'm on a Windows Server and I want to have a pipeline project on Jenkins that basically does this:

  • SVN update



  • Build



  • Deploy



As the deploy target machine is on a different network, I want to know how to start a VPN connection before to do the deploy.

Note: My general goal is to automate deployment to a server in a VPN. Currently the VPN is Cisco AnyConnect.

Solution

solutions is: OpenConnect Plugin

See here: https://wiki.jenkins.io/display/JENKINS/OpenConnect+Plugin

OR also you can use below method:

On Linux (Debian based)

sudo apt-get install openconnect


Add the following lines to the bottom of /etc/sudoers (ubuntu configuration)

jenkins ALL=NOPASSWD:/usr/sbin/openconnect*
jenkins ALL=NOPASSWD:/bin/kill*


Then you will get an option in the Jenkins run task called:

Connect to Cisco AnyConnect VPN

Code Snippets

sudo apt-get install openconnect
jenkins ALL=NOPASSWD:/usr/sbin/openconnect*
jenkins ALL=NOPASSWD:/bin/kill*
Connect to Cisco AnyConnect VPN

Context

StackExchange DevOps Q#3284, answer score: 2

Revisions (0)

No revisions yet.