0

How do I automate provisioning a new Managed Master?

My client has CloudBees deployed on OpenShift.  They are trying to create a self-service environment where a new managed (or team) master can be automatically provisioned when a new project request is submitted/approved.  Has anyone done this?  Are there documented APIs to accomplish this?

4 comments

  • 0
    Avatar
    James Nord Engineering

    There is a CLI that your provisioning tools can call. There is a CLI call for creating Teams and updating their membership, There is also a CLI for creating Managed Masters

     

  • 0
    Avatar
    Robert Patrick

    I tried using the cjoc cli managed-master-provision-and-start command but either I am doing something wrong or it does not work.  What am I missing?

    % java -jar jenkins-cli.jar -s https://<my-org>.cloudbees.net/cjoc/ -auth admin:<redacted> managed-master-provision-and-start master2

    ERROR: No such managed master exists: master2
    java -jar jenkins-cli.jar managed-master-provision-and-start NAME [--username VAL] [--password VAL] [--password-file VAL]
    Provisions and starts a Managed Master
    NAME : Managed master name
    --username VAL : User name to authenticate yourself to Jenkins
    --password VAL : Password for authentication. Note that passing a
    password in arguments is insecure.
    --password-file VAL : File that contains the password

    %

  • 0
    Avatar
    Allan Burdajewicz

    Robert,

    You need to provide the full name of the master. You can execute the following to get that information:

    java -jar jenkins-cli.jar -s https://<my-org>.cloudbees.net/cjoc/ -auth admin:<redacted> list-masters

    Regards,

  • 0
    Avatar
    Daniel Ritchie

    Sounds like you have a good solution identified, but FYI because I recently stumbled across this code snippet: 

    https://github.com/cloudbees/jenkins-scripts/blob/master/addClientMasterPlus.groovy

Please sign in to leave a comment.