mmagonde.jenkins-swarm
Ansible Role: Jenkins Swarm Agent
This role installs a Jenkins Agent on Windows servers using a swarm jar and runs it as a Windows service with NSSM.
Requirements
You need Java 8 or higher installed on the server.
Role Variables
Here are the available variables with their default values (check defaults/main.yml
):
jenkins_master_url
: 'http://localhost:8080'- This is the URL of your Jenkins master. Usually,
localhost
works fine as it communicates with the Jenkins server via HTTP.
- This is the URL of your Jenkins master. Usually,
agent_drive
: 'C:'agent_home
: "{{agent_drive}}\j"- This is the home directory for the Jenkins agent where it stores files, workspaces, and plugins. You can change the default path if needed.
jenkins_admin_username
: adminjenkins_admin_password
: admin- These are the credentials for the Jenkins master user.
name
: 'Jenkins_Agent'- This is the name of the agent.
version
: "3.3"- You can choose a specific version of the Jenkins agent swarm client from this link.
client_jar
: "swarm-client-{{version}}.jar"client_source
: "https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm-client/{{version}}/{{client_jar}}"- This is the URL to download the client jar file.
swarm_mode
: 'exclusive'- This setting controls how Jenkins assigns jobs to agents. Options are 'normal' (use the agent as much as possible) or 'exclusive' (only use for specific jobs). The default is exclusive.
swarm_executors
: '4'- This sets the number of executors.
swarm_labels
: 'windows'- These are labels to identify this agent, defaulting to 'windows'.
disableSslVerification
- This option can turn off SSL verification for HttpClient.
service_user
: "LocalSystem"service_pass
: undefined- This is the account under which the service will run. By default, it runs as
LocalSystem
with no password.
- This is the account under which the service will run. By default, it runs as
java
: 'C:\ProgramData\Oracle\Java\javapath\java.exe'- This is the path to the Java program on your system.
Dependencies
- Java must be installed on the system. Use the
geerlingguy.java
role for this.
Example Playbook
- hosts: jenkins_slave
vars:
jenkins_master_url: 'http://jenkins.example.com'
roles:
- { role: mmagonde.jenkins-windows-swarm }
License
Apache 2.0
Author Information
This role was created by Mutsa Magonde in 2017.