Jenkins 2.x disable initial admin setup

we're using Jenkins as a cron server adding/starting crons via api. We created a vagrant box installing the jenkins. Since version 2.0 jenkins require to create an admin account (link) before disable the security in config.xml. If no admin is created in jenkins, the config.xml (with disabled security) is overwritten. Is there any way to avoid this (maybe create an admin via bash command)?


Solution 1:

Google Groups state following

java -Djenkins.install.runSetupWizard=false -jar jenkins.war 

the

-Djenkins.install.runSetupWizard=false

disables the setup wizard & the admin user stuff.

Solution 2:

Providing the mentioned property in Jenkins parameters isn't enough. Just tested it. In order to really disable the setup wizard and "unlock" Jenkins you should also use a Groovy init script with contents like:

#!groovy

import jenkins.model.*
import hudson.util.*;
import jenkins.install.*;

def instance = Jenkins.getInstance()

instance.setInstallState(InstallState.INITIAL_SETUP_COMPLETED)

More details available following this link